2

I have a multimodule project containing three projects. I try to copy the content of src/main/config of each module to target/benchmark/config in the parent project directory.

parent
    pom.xml (second setup)
    /src/main/assembly/benchmark.xml
    /module1
    /module2
    /module3
    /aggregationparent
        pom.xml (first setup)
        /src/main/assembly/benchmark.xml

The assembly descriptor contained in the parent (aggregation project) under src/assembly/benchmark.xml

<formats>
    <format>dir</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<moduleSets>
    <moduleSet>
        <includes>
            <include>groupid:artifactid</include>
        </includes>
        <sources>
            <fileSets>
                <fileSet>
                    <directory>src/main/config/*</directory>
                    <outputDirectory>config</outputDirectory>
                </fileSet>
            </fileSets>
        </sources>
    </moduleSet>
</moduleSets>

The assembly plugin call

<build>
    <plugins>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <descriptor>src/main/assembly/benchmark.xml</descriptor>
                <finalName>benchmark</finalName>
                <appendAssemblyId>false</appendAssemblyId>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id> <!-- this is used for inheritance merges -->
                    <phase>package</phase> <!-- bind to the packaging phase -->
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

I tried this with two directory setups which both fail with different error messages:

  1. The parent is in a separate directory referencing its modules via ../modulename The result is:

    Building artifactid 1.0-SNAPSHOT
    ------------------------------------------------------------------------
    
    [assembly:single]
    The following patterns were never triggered in this artifact inclusion filter:
    o  'groupid:artifactid'
    
    ------------------------------------------------------------------------
    BUILD FAILURE
    ------------------------------------------------------------------------
    Total time: 4.187s
    Finished at: Mon May 06 18:28:59 CEST 2013
    Final Memory: 8M/104M
    ------------------------------------------------------------------------
    Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.4:single (default-cli) on project projectname: Failed to create assembly: Error creating assembly archive benchmark: You must set at least one file. -> [Help 1]  
    

    Here I guess the ../moduledir referencing causes an error leading to unresolvable modules in the assembly plugin. Is this right? What am I doing wrong?

  2. The parents pom is in the parent directory of the modules.
    Result:

    Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single (default-cli) on project *moduleid*: Error reading assemblies: No assembly descriptors found. -> [Help 1]
    

    The Debug output shows me that the assembly plugin tries to find the assembly descriptor in the project root of each selected module instead of using the one supplied in the parent project? Is this intended? How can I tell it to use the parent one?

4

0 回答 0