You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Dirk Jaeckel <mo...@dirk.jaeckel.name> on 2008/01/31 16:43:55 UTC

Filtering files from dependencySets with the assembly plugin

Hi!

I want to extract files from a dependent artifact (foo) and filter them before I put the 
into the assembly.

Given the following pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project>
   <modelVersion>4.0.0</modelVersion>
   <groupId>name.jaeckel.dirk</groupId>
   <artifactId>assemble</artifactId>
   <packaging>pom</packaging>
   <version>0.4-SNAPSHOT</version>
   <name>assemble</name>

   <dependencies>
     <dependency>
       <groupId>name.jaeckel.dirk</groupId>
       <artifactId>foo</artifactId>
       <version>0.4-SNAPSHOT</version>
     </dependency>
   </dependencies>

   <modules>
     <module>mod</module>
   </modules>

   <build>
     <plugins>
       <plugin>
         <artifactId>maven-assembly-plugin</artifactId>
         <version>2.2-beta-2-SNAPSHOT</version>
         <configuration>
           <filters>
             <filter>build.test.properties</filter>
           </filters>
           <descriptors>
             <descriptor>src/main/assembly/frontend.xml</descriptor>
           </descriptors>
         </configuration>
       </plugin>
     </plugins>
   </build>
</project>

the following assembly:

<?xml version="1.0"?>
<assembly>
     <id>frontend</id>
     <formats>
         <format>tar.gz</format>
     </formats>
     <files>
         <file>
             <source>src/main/files_file_filtered.txt</source>
             <filtered>true</filtered>
         </file>
     </files>
<!--
     <dependencySets>
       <dependencySet>
         <includes>
            <include>name.jaeckel.dirk:foo</include>
         </includes>
         <unpack>true</unpack>
         <unpackOptions>
            <filtered>true</filtered>
         </unpackOptions>
       </dependencySet>
     </dependencySets>
-->
     <moduleSets>
         <moduleSet>
             <binaries>
               <includes>
                 <include>name.jaeckel.dirk:mod</include>
               </includes>
	      <unpack>true</unpack>
               <unpackOptions>
                 <filtered>true</filtered>
               </unpackOptions>
               <dependencySets>
                 <dependencySet>
                   <includes>
                     <include>name.jaeckel.dirk:foo</include>
                   </includes>
                   <unpack>true</unpack>
                   <unpackOptions>
                     <filtered>true</filtered>
                   </unpackOptions>
                   </dependencySet>
                 </dependencySets>
             </binaries>
         </moduleSet>
     </moduleSets>
</assembly>

and build.test.properties:

foo=bar


In the resulting assembly only in src/main/files_file_filtered.txt foo gets replaced.
The files inside name.jaeckel.dirk:foo are not filtered regardless wether the dependencySet 
inside the moduleSets or the standalone version is used. The files from 
name.jaeckel.dirk:mod are also not filtered.


1. What am I doing wrong here?
2. Which earlier Version of the plugin (<2.2-beta-2-SNAPSHOT) supports filtering? All 
versions I tried give the following error:

[INFO] Error configuring: org.apache.maven.plugins:maven-assembly-plugin. Reason: ERROR: 
Cannot override read-only parameter: filters in goal: assembly:assembly


Thanks for your help,

Dirk Jaeckel



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org