概述
方法一
<profiles>
<profile>
<id>dev</id>
<properties>
<deploy.type>dev</deploy.type>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>test</id>
<properties>
<deploy.type>test</deploy.type>
</properties>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
</profile>
<profile>
<id>product</id>
<properties>
<deploy.type>product</deploy.type>
</properties>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
</profile>
</profiles>
<build>
<finalName>portal</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>test/**</exclude>
<exclude>product/**</exclude>
<exclude>dev/**</exclude>
<exclude>mybatis-generator/**</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources/${deploy.type}</directory>
</resource>
</resources>
<plugins>
<!-- compiler插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
</plugins>
</build>
方法二
<profiles>
<profile>
<id>devtest</id>
<build>
<defaultGoal>package</defaultGoal>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>wisea.properties</exclude>
<exclude>log4j.xml</exclude>
</excludes>
</resource>
<resource>
<directory>src/devtest/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<configuration>
<target>
<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask" />
<deploy url="http://192.168.20.208:8090/manager/text"
username="tomcatMa" password="tomcatMA13%" path="/nfsj.admin"
war="file:${project.build.directory}/${project.build.finalName}.${project.packaging}"
update="true" />
</target>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>catalina-ant</artifactId>
<version>6.0.45</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>production</id>
<build>
<defaultGoal>package</defaultGoal>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>wisea.properties</exclude>
<exclude>log4j.xml</exclude>
</excludes>
</resource>
<resource>
<directory>src/production/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<webResources>
<resource>
<directory>src/production/webapp/</directory>
<targetPath>/</targetPath>
<includes>
<include>static/js/common/wbf-init.js</include>
</includes>
</resource>
<resource>
<directory>src/main/webapp/</directory>
<targetPath>/</targetPath>
<excludes>
<exclude>static/js/common/wbf-init.js</exclude>
</excludes>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
最后
以上就是糊涂小虾米为你收集整理的maven profile具体项目中的使用的全部内容,希望文章能够帮你解决maven profile具体项目中的使用所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复