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>
        <directory>conf</directory>
        <includes>
          <include>*.tmpl.xml</include>
        </includes>
        <filtering>true</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]

Reply via email to