Created
October 19, 2012 05:40
-
-
Save dlundy/3916409 to your computer and use it in GitHub Desktop.
Sample Maven pom.xml using per-environment configuration and local repo
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>com.mycorp.project</groupId> | |
<artifactId>project</artifactId> | |
<packaging>war</packaging> | |
<version>1.0-SNAPSHOT</version> | |
<name>Sample Maven Webapp</name> | |
<url>http://www.example.com</url> | |
<build> | |
<filters> | |
<filter>src/main/resources/env/${env}.properties</filter> | |
</filters> | |
<!-- Filter other resources to the java directory --> | |
<resources> | |
<resource> | |
<directory>src/main/resources</directory> | |
<filtering>true</filtering> | |
<includes> | |
<include>*.properties</include> | |
<include>*.xml</include> | |
</includes> | |
</resource> | |
</resources> | |
<finalName>project</finalName> | |
</build> | |
<properties> | |
<!-- default environment --> | |
<env>dev</env> | |
<!-- Set default encoding to UTF-8 --> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
</properties> | |
<!-- environment definitions --> | |
<profiles> | |
<profile> | |
<id>dev</id> | |
<properties> | |
<env>dev</env> | |
</properties> | |
</profile> | |
<profile> | |
<id>qa</id> | |
<properties> | |
<env>qa</env> | |
</properties> | |
</profile> | |
<profile> | |
<id>prod</id> | |
<properties> | |
<env>prod</env> | |
</properties> | |
</profile> | |
</profiles> | |
<!-- Create a local repo so we can distribute jars without using the system scope --> | |
<!-- http://blog.dub.podval.org/2010/01/maven-in-project-repository.html --> | |
<repositories> | |
<repository> | |
<id>lib</id> | |
<name>lib</name> | |
<releases> | |
<enabled>true</enabled> | |
<checksumPolicy>ignore</checksumPolicy> | |
</releases> | |
<snapshots> | |
<enabled>false</enabled> | |
</snapshots> | |
<url>file://${project.basedir}/lib</url> | |
</repository> | |
</repositories> | |
<dependencies> | |
<!-- dependencies here --> | |
</dependencies> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment