Created
December 31, 2009 21:53
-
-
Save charliek/266931 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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>org.codehaus.trygvis.blog</groupId> | |
<artifactId>simpleenvironment</artifactId> | |
<packaging>jar</packaging> | |
<version>1.0-SNAPSHOT</version> | |
<name>Building For Different Environments with Maven 2 Example Code</name> | |
<url>http://blogs.codehaus.org/people/trygvis</url> | |
<dependencies> | |
<dependency> | |
<groupId>junit</groupId> | |
<artifactId>junit</artifactId> | |
<version>3.8.1</version> | |
<scope>test</scope> | |
</dependency> | |
</dependencies> | |
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-jar-plugin</artifactId> | |
<configuration> | |
<classifier>${environment.suffix}</classifier> | |
</configuration> | |
<goals> | |
<goal>jar</goal> | |
</goals> | |
</plugin> | |
</plugins> | |
</build> | |
<profiles> | |
<profile> | |
<id>test</id> | |
<build> | |
<plugins> | |
<plugin> | |
<artifactId>maven-antrun-plugin</artifactId> | |
<executions> | |
<execution> | |
<phase>test</phase> | |
<goals> | |
<goal>run</goal> | |
</goals> | |
<configuration> | |
<tasks> | |
<delete file="${project.build.outputDirectory}/environment.properties"/> | |
<copy file="src/main/resources/environment.test.properties" tofile="${project.build.outputDirectory}/environment.properties"/> | |
</tasks> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
</plugins> | |
</build> | |
<properties> | |
<environment.suffix>test</environment.suffix> | |
</properties> | |
</profile> | |
<profile> | |
<id>prod</id> | |
<build> | |
<plugins> | |
<plugin> | |
<artifactId>maven-antrun-plugin</artifactId> | |
<executions> | |
<execution> | |
<phase>test</phase> | |
<goals> | |
<goal>run</goal> | |
</goals> | |
<configuration> | |
<tasks> | |
<delete file="${project.build.outputDirectory}/environment.properties"/> | |
<copy file="src/main/resources/environment.prod.properties" tofile="${project.build.outputDirectory}/environment.properties"/> | |
</tasks> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
</plugins> | |
</build> | |
<properties> | |
<environment.suffix>prod</environment.suffix> | |
</properties> | |
</profile> | |
</profiles> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment