Hi Vincent,

This is great! However, there is one problem: you'll need to add <fileset ... overwrite="${resource.filtering}"> as well, as overwrite needs to be enabled for filtering.

Also, I'd prefer to see filter loading incorporated into the POM.
<build>
  <resources>
    <filters>
      <id>my.filters</id>
      <directory>${basedir}/../filters</directory>
      <includes>
        <include>**/*.properties</include>
      </includes>
    </filters>
    <resource>
      <filtersets>
        <filterset>my.filters</filterset>
        <filterset>base.filters</filterset>
      </filtersets>
      ...
    </resource>
  </resources>
</build>

Resulting copy:
<fileset dir="..." overwrite="${!resources.filtersets.isEmpty()}">
  ...
  <j:forEach var="filterset" items="${resources.filtersets}">
    <filterset refid="${filterset}"/>
  </j:forEach>
</fileset>

I'd be happy to implement this if others agree this belongs in the POM.

- Brett

Vincent Massol wrote:
Hi,

I've just committed a new feature in CVS: filtering of runtime resources
and test resources. I've also committed a sample project that shows how
to use it, in src/plugins-build/examples/simple-filtering

Basically, whenever you want to filter some tokens in resources, use the
following syntax in your project.xml:

  <build>
        <sourceDirectory>src/java</sourceDirectory>

    <resources>
      <resource>
-->     <filtering>true</filtering>
        <directory>src/conf</directory>
        <includes>
          <include>test.properties</include>
        </includes>
      </resource>
      <resource>
        <directory>src/conf</directory>
        <includes>
          <include>test-nofilter.properties</include>
        </includes>
      </resource>
    </resources>

</build>

Then write a pregoal on java:jar-resources or test:test-resources in
your project's maven.xml and create your Ant filter tokens there.

By default, filtering is off.

NOTE: For some unknown reasons the filtering does not seem to work yet
on the simple-filtering project. Not sure why... I'm debugging it...
Help welcome :-)

Thanks
-Vincent


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

-- Web Developer f2 network ~ everything essential 02 8596 4437


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



Reply via email to