Jason wrote:,
> One thing I would love to see is how to set-up maven to get one
project
> to target different environments - dev, uat, live. For example each
> environment will want a different log4j.properties, some different
> tokens for filtering, etc.
> I keep thinking there must be a clean, simple way of doing this, but
> it escapes me.
Its now much easier with m2, with m1 I wrote my own plugin to do it:
In my top level pom (parent pom for all projects) I have:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<filtering>true</filtering>
<filterPropertiesFile>
${resource.filter.file}
</filterPropertiesFile>
</configuration>
</plugin>
</plugins>
</build>
In my settings.xml I have:
<profiles>
<profile>
<id>live</id>
<properties>
<resource.filter.file>
${basedir}/conf/${project.artifactId}-live.properties
</resource.filter.file>
</properties>
</profile>
<profile>
<id>uat</id>
<properties>
<resource.filter.file>
${basedir}/conf/${project.artifactId}-uat.properties
</resource.filter.file>
</properties>
</profile>
<profile>
<id>dev</id>
<properties>
<resource.filter.file>
${basedir}/conf/${project.artifactId}-dev.properties
</resource.filter.file>
</properties>
</profile>
</profiles>
Under the project directory there is a directory called conf, with on
one fileter file per target env e.g thisproject-dev.properties.
Run 2 with the target env profile e.g m2 -P live and all the resource
files will be filtered with the with the correct target values.
Not sure if it is the best way to do it in m2, but is nice and simple.
And easy for each project to use.
Tony
Tony
http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain
personal views which are not the views of the BBC unless specifically
stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in
reliance on it and notify the sender immediately. Please note that the
BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]