您的位置:首页 > 其它

maven 之 根据不同环境,选择不同的配置文件。

2013-01-24 10:47 423 查看
没用maven前,本地开发用的是一套配置,然后 测试环境和生产环境 又是另一个套,为了方便,以前还特地写了shell去弄。

自从用了maven后,这个问题就很好解决了

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion>
<groupId>com.toprays</groupId>
<artifactId>dfadmin</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<name />
<description />
<dependencies>
*****
</dependencies>
<profiles>
<profile>
<id>dev</id>
<properties>
<resPath>config</resPath>
</properties>
</profile>
<profile>
<id>pro</id>
<properties>
<resPath>product</resPath>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
</profiles>
<build>
<finalName>dfadmin</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<webappDirectory>${basedir}/webapps</webappDirectory>
<warSourceDirectory>${basedir}/webapps</warSourceDirectory>
<webResources>
<resource>
<directory>${resPath}</directory>
<targetPath>WEB-INF/classes</targetPath>
<filtering>true</filtering>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: