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]

Reply via email to