There was some hesitation to adding filtering in the first place - we
added it as a parameter on the resources plugin because it was
uncertain it would be retained in the POM. It now looks like it will,
but we're wary of how it is used.

It is important for Maven to work that the values filtered in are
always the same if the artifact being built is the same. If you want
to build 2 different artifacts, you use 2 profiles (or two projects),
and provide different filters to each.

I'm curious why you need different filters for different sets of files
- do they have changing values or is it just an "optimisation"?

Also, it should be noted that Maven builds in a pom.properties file
into META-INF as well as a copy of pom.xml so that you can retrieve
such values at runtime if needed.

Anyway, I'm happy to discuss what the filtering needs are and adjust
accordingly. I'm still reluctant to promote filters to the resource
element itself, but it can be considered again.

Cheers,
Brett

On 8/20/05, Andrius Karpavicius <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I am almost an expert here, after trying to get filtering work for two
> days :)
> 
> 
> From resources plugin code:
> 
>                 // support ${token}
>                 Reader reader = new InterpolationFilterReader( fileReader,
> filterProperties, "${", "}" );
>                 // support @token@
>                 reader = new InterpolationFilterReader( reader,
> filterProperties, "@", "@" );
> 
>                 reader = new InterpolationFilterReader( reader, new
> ReflectionProperties( project ), "${", "}" );
> 
> 
> It seems like you can replace trwo things :
> 
> 1. From a properties file  in a format ${token} or @token@
> 2. From a POM.xml file ${project.version}
> 
> To apply different filtering to diferent resources you would have to
> define resoruces as part of maven-resources-plugin configuration,
> 
> Unfortunatelly I was not able to do so. It would simply ignore my
> resources settings. You can see earlier emails.
> 
> Can somebory tell what is a proper way of configuring resources in
> plugin/config section, or is it a bug?
> 
> 
>      <plugin>
>        <groupId>org.apache.maven.plugins</groupId>
>        <artifactId>maven-resources-plugin</artifactId>
>        <executions>
>          <execution>
>            <phase>compile</phase>
>            <goals>
>              <goal>resources</goal>
>            </goals>
>            <configuration>
>              <resources>
>                <resource>
>                  <targetPath>../filtered-webapp-resources</targetPath>
>                  <directory>${basedir}/src/main/webapp</directory>
>                </resource>
>                <resource>
>  <targetPath>../filtered-webapp-resources/WEB-INF/classes</targetPath>
>                  <directory>${basedir}/src/main/resources</directory>
>                </resource>
>              </resources>
> 
> <outputDirectory>${project.build.directory}/${project.build.finalName}/copiedwithresources</outputDirectory>
> 
> <filterPropertiesFile>${basedir}/src/filters/filter.properties</filterPropertiesFile>
>              <filtering>true</filtering>
>            </configuration>
>           </execution>
>         </executions>
>       </plugin>
> 
> 
> 
> 
> 
> 
> Carsten Ziegeler <[EMAIL PROTECTED]>
> 2005.08.19 15:20
> Please respond to
> "Maven Users List" <users@maven.apache.org>
> 
> 
> To
> users@maven.apache.org
> cc
> 
> Subject
> [M2] How does filtering resources work?
> 
> 
> 
> 
> 
> 
> I'm a little confused how filtering of resources in M2 works.
> Now, I can define several resource sets in the build resources
> section (with include/exclude) patterns. But there is no way
> of defining filters there. (At least that's what I think).
> 
> Now I can turn on filtering in the resources plugin. I guess without
> any additional configuration, this enables filtering for *all* resources.
> So if I only want to filter one resource set (defined in the build
> section), do I have to specify the same resources in the plugin
> configuration as well? Wouldn't it be better to define the filters
> directly at the resources in the build section?
> 
> On the same topic, is it possible to have filters that replace tokens
> with values from the pom, like project name or version?
> 
> Thanks
> Carsten
> --
> Carsten Ziegeler - Open Source Group, S&N AG
> http://www.s-und-n.de
> http://www.osoco.org/weblogs/rael/
> 
> ---------------------------------------------------------------------
> 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]
> 
>

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

Reply via email to