Re: How to properly use filtering on resources.
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... Thanks, Rick On Feb 14, 2005, at 3:13 PM, Brett Porter wrote: 1) It doesn't filter anything. Files are not touched, just copied. Double check your resource set matches the one copied, and that it doesn't overlap with another one defined to contain the same files without filtering. 2) Maven always try to load a file named some.properties ?! That's not from Maven - search your project.xml, maven.xml and project.properties files, including any you inherit from using extend/. I'm now using : preGoal name=java:jar-resources ant:filter filtersfile=config/environnement/${platform}.conf / copy todir=target/classes filtering=false overwrite=true fileset dir=config/template / /copy /preGoal This is equivalent to using the resources, however will not allow other parts of Maven (eg the IDE plugins) to see where you reosources are. - Brett - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to properly use filtering on resources.
On Feb 21, 2005, at 11:55 AM, Damien Raude-Morvan wrote: 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, Thanks. It's this last part that I'm unclear about. I can see how to do this with a hack, but I'd rather do it the right way. Ideally I'd like to have the templates not included in the final war, just the filtered and renamed files. So I guess what I'm looking for is a hook into the filtering mechanism, perhaps as a preGoal before it does the copy. It seems to me like either there is a good deal of documentation missing on this or it would be better for filtering to be extracted out into a plugin instead of having it as a core feature of maven. I guess what I might be missing is this: what is the input to the preGoal name=jar:jar-resources? Is there an object that we can grab and work with? I'd assume there's a list of files being passed around somewhere. Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to properly use filtering on resources.
Ok, I've been reading lots of jelly this morning... now I have a clear understanding of what exactly my question is :-) So, I have the following preGoal: preGoal name=java:jar-resources ant:filter filtersfile=${basedir}/conf/configuration.properties / /preGoal I have 1 file being filtered: resources resource directoryconf/directory includes include*.tmpl.xml/include /includes filteringtrue/filtering /resource /resources Ok, now what happens here is that the resource hibernate.conf.tmpl.xml gets filtered and copied into target/clasess just fine, but I want it to be renamed. The confusing part is this: I looked at the java:jar-resources jelly and it looks like all it does is peek at the pom.build.resources, applies the filename filtering, and copies the files. goal name=java:jar-resources description=Copy any resources that must be present in the deployed JAR file j:if test=${!pom.build.resources.isEmpty()} maven:copy-resources resources=${pom.build.resources} todir=${maven.build.dest}/ /j:if /goal So here's my question: (I know you've all been waiting...) Where do the filtered resources go before they are copied? There is no copy kept in my conf directory... after the preGoal is executed and the ant:filter happens, where do the files go? Are they kept in the build object as StringBuffers or File objects? I'm tempted to edit these in their temporary living quarters, seems like if I stepped in after the filtering, before the jar:resources copy-resources tag is executed I could simply rename the output file and everything would be great... Thanks, in the very least I'm learning a lot about the internals of maven :-) Rick On Feb 21, 2005, at 12:00 PM, Rick Mangi wrote: On Feb 21, 2005, at 11:55 AM, Damien Raude-Morvan wrote: 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, Thanks. It's this last part that I'm unclear about. I can see how to do this with a hack, but I'd rather do it the right way. Ideally I'd like to have the templates not included in the final war, just the filtered and renamed files. So I guess what I'm looking for is a hook into the filtering mechanism, perhaps as a preGoal before it does the copy. It seems to me like either there is a good deal of documentation missing on this or it would be better for filtering to be extracted out into a plugin instead of having it as a core feature of maven. I guess what I might be missing is this: what is the input to the preGoal name=jar:jar-resources? Is there an object that we can grab and work with? I'd assume there's a list of files being passed around somewhere. Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to properly use filtering on resources.
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello, On Monday 14 February 2005 21:13, Brett Porter wrote: 1) It doesn't filter anything. Files are not touched, just copied. Double check your resource set matches the one copied, and that it doesn't overlap with another one defined to contain the same files without filtering. Many thanks, you made me look at the right place : my filtering/ was not at the right place : child node of include/ instead of resource/... 2) Maven always try to load a file named some.properties ?! That's not from Maven - search your project.xml, maven.xml and project.properties files, including any you inherit from using extend/. You're right. I didn't know that extend../otherproject/project.xml/extend also extend maven.xml of otherproject ! I'm now using : preGoal name=java:jar-resources ant:filter filtersfile=config/environnement/${platform}.conf / copy todir=target/classes filtering=false overwrite=true fileset dir=config/template / /copy /preGoal This is equivalent to using the resources, however will not allow other parts of Maven (eg the IDE plugins) to see where you reosources are. That's why I was asking another way to do this :) Have a good day, - -- Damien Raude-Morvan / DrazziB GPG : 0x85C79389 (new!) WWW : www.drazzib.com ICQ : 68119943 TEL : (+33) 06 08 80 36 98 -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCEnrqyIFXyIXHk4kRAoiyAJ4vMIfKk8ZMwTyYOvAQhtZiq/uiBgCgmvqr HLssLAbPCmsAGGWbSJMVNFo= =Vy9Z -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to properly use filtering on resources.
1) It doesn't filter anything. Files are not touched, just copied. Double check your resource set matches the one copied, and that it doesn't overlap with another one defined to contain the same files without filtering. 2) Maven always try to load a file named some.properties ?! That's not from Maven - search your project.xml, maven.xml and project.properties files, including any you inherit from using extend/. I'm now using : preGoal name=java:jar-resources ant:filter filtersfile=config/environnement/${platform}.conf / copy todir=target/classes filtering=false overwrite=true fileset dir=config/template / /copy /preGoal This is equivalent to using the resources, however will not allow other parts of Maven (eg the IDE plugins) to see where you reosources are. - Brett - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]