Rick Mangi a �crit :
So what is the proper way to do the following:

1) Filter a config file to put the properties in place
2) Copy the file to the target directory and rename it

For example: I have a property file called hibernate.conf.tmpl.xml and I want it to be filtered and then copied as hibernate.conf.xml

Any ideas? I'd rather not have to know the name of the file ahead of time...

In your project.xml, you should activate filtering on a particular resource (done via <filtering/> tag). This resource should include *.tmpl.xml files :
<resource>
<directory>${basedir}/src/resources/</directory>
<includes>
<include>*.tmpl.xml</include>
</includes>
<filtering>true</filtering>
</resource>



In your maven.xml, you define a new pre-dependency on goal "test:test-resources" or "jar:jar-resources" (depends on what you want) :


<j:set var="platform" value="dev"/>

<preGoal name="jar:jar-resources">
        <util:available file="${basedir}/config/${platform}.properties">
                <echo>Filtering files fot use with -${platform}- 
parameters.</echo>
                <ant:filter filtersfile="${basedir}/config/${platform}.conf" />
        </util:available>
</preGoal>

In this case, it's read properties from a file in config/dev.properties. With some tweaks (jelly tags), you should achieve to rename the file after copy. But IMHO, it's simplier to have "templates/" and "filtered/" directory than templates and filtered files in same dir.

--
Damien Raude-Morvan
Movalys / www.movalys.com
Adeuza / www.adeuza.fr

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to