I keep all the conf files in each project's src/conf directory and we do not
put them in our jars because that's not practical for production (the
sysadmin doesn't know how to find the jar, unzip it, modify, rezip, etc.).
So I wrote some goals in my maven.xml to copy the jars from all dependent
projects. I copy them into src/conf.dep. I then take src/conf.dep and copy
to src/conf.dev, and then copy src/conf to src/conf.dev. Sounds complicated
but it's not too bad:
src/conf - original, unfiltered resources
src/conf.dep - filtered dependency resources
src/conf.dev - filtered original & dependency resources (original can
override dependency)
The maven.xml code is very ugly, but it works and I haven't had time to
optimize it:
<goal name="copy-dep-res">
<echo>Copying dependency resources for project ${pom.artifactId}</echo>
<ant:delete dir="${basedir}/src/conf.dep"/>
<ant:mkdir dir="${basedir}/src/conf.dep"/>
<j:forEach items="${pom.dependencies}" var="dep" indexVar="depNumber">
<j:forEach items="${dep}" var="depItem" indexVar="depItemNumber">
<util:tokenize var="depItemItems"
delim=":">${depItem}</util:tokenize>
<j:forEach items="${depItemItems}" var="depItemItem">
<util:tokenize var="depItemItemItems" delim="
">${depItemItem}</util:tokenize>
<j:forEach items="${depItemItemItems}" var="depProject">
<util:available file="../${depProject}/src">
<util:available file="../${depProject}/src/conf">
<echo>${depProject} is available</echo>
<ant:copy todir="${basedir}/src/conf.dep" filtering="false"
overwrite="true">
<ant:fileset dir="../${depProject}/src/conf">
<ant:exclude name="**/empty_file_for_cvs.txt"/>
<ant:exclude name="**/configuration.xml"/>
<ant:exclude name="**/.cvsignore"/>
</ant:fileset>
</ant:copy>
</util:available>
<ant:copy file="${basedir}/../maven/resource.cvsignore"
tofile="${basedir}/src/conf.dep/.cvsignore"
overwrite="true"/>
</util:available>
</j:forEach>
</j:forEach>
</j:forEach>
</j:forEach>
</goal>
Yes, I know, it actually copies the resources for each project twice. But
it's so fast I haven't bothered to fix this (tough deadlines here)
Michael
> -----Message d'origine-----
> De : G�schl,Siegfried [mailto:[EMAIL PROTECTED]
> Envoy� : lundi 28 juin 2004 16:08
> � : Maven Users List
> Objet : RE: config files dependencies
>
>
> Hi Alexander,
>
> I have the same problems with Torque.properties, log4j.properties
> and spy.properties. I keep a folder for each set of configuration
> files for each build mode. To determine the build mode I pass a
> 'maven.build.mode' for building all project but I'm not using the
> reactor (yet)
>
> Cheers,
>
> Siegfried Goeschl
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Montag, 28. Juni 2004 14:09
> To: [EMAIL PROTECTED]
> Subject: config files dependencies
>
>
>
> Hi!
>
> I need some advice. I need to copy config file from one subproect
> to another. I know one way to solve this problem. I can spesify
> this cofig files as resourses in one subproject and spesify the
> second subproject as being dependent from the first one.
>
> But I have two problems:
>
> 1. This config files have to be unjared. (P6SpyDriver wants its
> config file - spy.properties - not to be in jar)
>
> 2. To test the second subprojct I need to use testing version of
> the config files from the first one.
>
> I'm going to copy config files and their testing versions from
> the first subproject to the second one:
>
>
>
> <maven:reactor
>
> basedir="${basedir}/.."
>
> includes="firstProject/project.xml"
>
> goals="test:test-resources"
>
> postProcessing="true"
>
> />
>
> <ant:copy todir="${maven.test.dest}">
>
> <fileset
> dir="${reactorProjects.get(0).context.getVariable('maven.test.dest')}">
>
> <include name=spy.properties"/>
>
> <include name="OJB*.*"/>
>
> </fileset>
>
> <ant:copy>
>
>
>
> <>Would it be the right desision?
>
> --
>
> Maksimenko Alexander
>
> Softwarium, www.softwarium.net
>
>
--
This E-mail is confidential. It may also be legally privileged. If you are
not the addressee you may not copy, forward, disclose or use any part of it.
If you have received this message in error, please delete it and all copies
from your system and notify the sender immediately by return E-mail.
Internet communications cannot be guaranteed to be timely, secure, error or
virus-free. The sender does not accept liability for any errors or omissions.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]