You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Erik Drolshammer <dr...@idi.ntnu.no> on 2007/03/14 11:13:20 UTC
Config-files as templates
Hi!
I have a M2 project where we utilize two template files. Ie., two copy
statements is necessary before the project will build:
cp log4j.properterties.tmpl log4j.properties
cp profiles.xml.tmpl profiles.xml
As far as I have learned, the "good" solution is to not use .tmpl and
just put the files in subversion. We don't want this solution, because
the developers sometimes (too often) commit their modified versions by
accident.
Is it possible to do a
if (!filesExist) {
cp log4j.properterties.tmpl log4j.properties
cp profiles.xml.tmpl profiles.xml
}
from a maven-plugin?
Please recommend plugin(s) that support this kind of functionality.
My goal is to again allow the project to build successfully directly
from a svn-checkout.
--
Kind regards,
Erik Drolshammer
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Config-files as templates
Posted by Erik Drolshammer <dr...@idi.ntnu.no>.
Erik Drolshammer wrote:
> Is it possible to do a
>
> if (!filesExist) {
> cp log4j.properterties.tmpl log4j.properties
> cp profiles.xml.tmpl profiles.xml
> }
>
> from a maven-plugin?
Yes, it is, with antrun:
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<!-- Overwrite defaults to false, so if the files already
exists they will not be overwritten -->
<copy file="profiles.xml.tmpl" tofile="profiles.xml"/>
<copy file="src/main/resources/log4j.properties.tmpl"
tofile="src/main/resources/log4j.properties"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
--
Kind regards,
Erik Drolshammer
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org