You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Winter <er...@adflow-systems.de> on 2009/10/21 18:08:14 UTC

Copy resources from dependent maven projects

Hey guys,

I'm searching for an issue of coping resources from dependent maven projects
within the maven-assembly-plugin.

The goal is to get all configuration files, from the assembled project and
all its dependencies.

 

For example:

Maven-Project A

                /src/main/java/..

                /src/main/resources/config/file1.txt

Maven-Project B

                /src/main/java/..

                /src/main/resources/config/file2.txt

Maven-Project B has Project A declared as dependency.

 

When Maven-Project B is assembled, the result should be

Maven-Project B

                /src/main/java/..

                /src/main/resources/config/file2.txt

                /target/dist/config/file1.txt

                /target/dist/config/file2.txt

 

C:\workspace\ProjectB> mvn assembly: assembly

 

In fact, my current result is

Maven-Project B

                /src/main/java/..

                /src/main/resources/config/file2.txt

                /target/dist/config/file2.txt

 

                

A simplified version of my configuration:

Project B pom.xml

~~~~~~~~~~~~~~~~~

..

<resources>

                <resource>

                               <directory>src/main/resources</directory>

                               <excludes>

                                               <exclude>**/*.*</exclude>

                               </excludes>

                </resource>

</resources>

..

<plugin>

                <artifactId>maven-assembly-plugin</artifactId>

                <version>2.2-beta-2</version>

                <executions>

                               <execution>

                                               <id>make-assembly</id>

                                               <phase>install</phase>

                                               <goals>

 
<goal>assembly</goal>

                                               </goals>

                               </execution>

                </executions>

                <configuration>

                               <appendAssemblyId>false</appendAssemblyId>

                               <outputDirectory>target</outputDirectory>

 
<includeBaseDirectory>false</includeBaseDirectory>

 
<ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>

                               <FailureIgnore>false</FailureIgnore>

                               <descriptors>

 
<descriptor>assembly.xml</descriptor>

                               </descriptors>

                </configuration>

</plugin>

..

 

 

 

assembly.xml

~~~~~~~~~~~~

<assembly>

                <id>dist</id>

                <formats>

                               <format>dir</format>

                </formats>

                <includeBaseDirectory>false</includeBaseDirectory>

                <fileSets>

                               <fileSet>

 
<directory>src/main/resources</directory>

                                               <includes>

 
<include>**/*.*</include>

                                               </includes>

 
<outputDirectory>target/dist</outputDirectory>

                               </fileSet>

                </fileSets>

</assembly>

 

The configuration is slightly adjusted to match to the example above. I have
left out the part coping Jars.

I used the dependency-plugin to copy the Jars into the target folder. 

But I can't use the resources-plugin (copy-resources), because I don't know
how many resources are placed in the dependent project.

 

 

With regards,

Erik-F Winter