在项目的web环境或者需要打包对应不同的环境我们使用profiles区别是打包测试环境的包还是生产环境的,这里我说一下maven打包时候的配置
<profiles>
<profile>
<id>production</id>
<properties>
<p1>值</p1>
</properties>
</profile>
<profile>
<id>development</id>
<properties>
<p1>值</p1>
</properties>
</profile>
</profiles>
类似与配置的properties文件。只不过这个是在打包时候动态加载的数据
在maven打包时候我们需要指定打包的profile,需要添加-P参数
mvn clean package -Dmaven.test.skip=true -Pdevelopment
如果觉得打包时候使用-P比较烦时候可以使用
<profiles>
<profile>
<id>production</id>
<properties>
<p1>值</p1>
</properties>
</profile>
<profile>
<id>development</id>
<properties>
<p1>值</p1>
</properties>
<activation>
//添加对应默认的配置
<activeByDefault>true</activeByDefault>
</activation>
</profile>
</profiles>
还有一种方式可以指定或者是默认想打包那个可以在settings中添加以下默认的配置
<settings>
<activeProfiles>
<activeProfile>development</activeProfile>
</activeProfiles>
</settings>
据说可以一次打包两个,没有试过。有兴趣的可以试试
mvn -P development,test clean install 同时执行development和test两个profile
分享到:
相关推荐
Maven-assembly-plugin是maven中针对打包任务而提供的标准插件,可以实现自定义打包。主要提供如下功能: ● 提供一个把工程依赖元素、模块、网站文档等其他文件存放到单个归档文件里。 ● 打包成指定格式分发包,...
Spring Boot项目使用maven-assembly-plugin根据不同环境打包成tar.gz或者zip
apache-maven-3.8.6-bin.tar.tz--test apache-maven-3.8.6-bin.tar.tz--test apache-maven-3.8.6-bin.tar.tz--test apache-maven-3.8.6-bin.tar.tz--test apache-maven-3.8.6-bin.tar.tz--test apache-maven-3.8.6-...
Maven使用tomcat8-maven-plugin插件
maven3-plugin-3.0.1-sources.jar
Maven-apache-maven-3.8.1-Repository-配置好的-Window10 解压配置一下环境变量就可以用
maven资源 apache-maven-3.3.9-bin.zip
解决tomcat8-maven-plugin-3.0-r1655215.jar阿里云同有的问题。放到路径org\apache\tomcat\maven\tomcat8-maven-plugin\3.0-r1655215\就可以了
apache-maven-3.0.5 apache-maven-3.1.1 apache-maven-3.2.5 apache-maven-3.3.9 apache-maven-3.5.4 apache-maven-3.6.3 apache-maven-3.8.5 每个版本包含4个文件: apache-maven-3.8.5-bin.tar.gz apache-maven-...
apache-maven-3.8.6-bin.zip apache-maven-3.8.6-bin.zip apache-maven-3.8.6-bin.zip apache-maven-3.8.6-bin.zip apache-maven-3.8.6-bin.zip apache-maven-3.8.6-bin.zip apache-maven-3.8.6-bin.zip apache-...
maven-deploy-plugin-2.8.2.jar
MAVEN-配置a
maven-archetype-webapp-1.0.jar,下载,如果有需要的同志可以自己下载,。
maven-jar-plugin-3.1.1.jar
maven-project-info-reports-plugin-2.2.jar
maven-surefire-plugin-2.22.1.jar
maven-shared-utils-3.2.1.jar
maven-deploy-plugin-2.7.jar
maven-archetype-quickstart-1.1.jar包下载
maven-site-plugin-3.3.jar