我在做
./mvnw -Pprod clean verify
并且以dev开头,没有产品概要。
我是否需要更改pom文件中的某些内容?
<id>prod</id>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>target/classes/static/</directory>
</fileset>
</filesets>
</configuration>
</plugin>
要在Debian服务器中设置为服务,我要做:
sudo chmod +x /var/lib/nms-api/n2.jar
sudo chown nmsapi:nmsapi /var/lib/nms-api/n1.jar
sudo ln -s /var/lib/nms-api/n2.jar /etc/init.d/nms2
sudo systemctl enable nms2
sudo service nms2 start
您正在混淆Maven配置文件和Spring Boot配置文件。它们是两个完全独立的概念。 Maven概要文件是用于在构建期间打开特定步骤的标志,而spring概要文件是一个运行时标志,用于告诉spring应用哪个配置集。有关弹簧轮廓的更多信息,您可以see here
Spring概要文件可以通过systen属性,环境变量进行设置,也可以通过您的Maven构建进行设置。前两个是更灵活的imo。
系统属性
java -Dspring.profiles.active=prod
环境变量
export SPRING_PROFILES_ACTIVE=prod
作为Maven构建配置文件的一部分
<profiles>
<profile>
<id>prod</id>
<properties>
<spring.profiles.active>prod</spring.profiles.active>
</properties>
<!-- The rest of your profile here -->
</profile>
</profiles>