I have the following problem. I have a multi-module project. I want to run the maven-assembly plugin on a toplevel pom, which is also the parent pom for its modules. I want the plugin to execute only on the top level pom. He is currently trying to execute on all submodules. I do not want this, because I just need to capture all the sources from all the modules and submodules in one place (the target directory is toplevel.)
Here is my descriptor:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>src</id>
<formats>
<format>zip</format>
</formats>
<moduleSets>
<moduleSet>
<includeSubModules>true</includeSubModules>
<sources>
<useDefaultExcludes>true</useDefaultExcludes>
<includeModuleDirectory>false</includeModuleDirectory>
<fileSets>
<fileSet>
<outputDirectory>/</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<includes>
<include>src/main/**</include>
<include>src/test/**</include>
<include>target/classes/**</include>
</includes>
</fileSet>
</fileSets>
</sources>
</moduleSet>
</moduleSets>
The pom file is as follows:
<?xml version="1.0"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>myid</groupId>
<artifactId>myartid</artifactId>
<version>1.1</version>
</parent>
<groupId>myid2</groupId>
<artifactId>TopLevelBuild</artifactId>
<packaging>pom</packaging>
<version>5.5-SNAPSHOT</version>
<name>Some Application</name>
<modules>
<module>1</module>
<module>2</module>
<module>3</module>
<module>4</module>
<module>5</module>
<module>6</module>
</modules>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit-dep</artifactId>
<version>4.8.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Parent pom just contains some dependencies that I want to inherit in all modules. Submodules have the current pom as the parent. Now, if I run:
mvn assembly: single -Ddescriptor = somedes.xml
, . , , , . ?
...
[INFO] Processing sources for module project: LAST MODULE
[INFO] Building zip: ..../target/TopLevelBuild-5.5-SNAPSHOT-src.zip
[INFO] ------------------------------------------------------------------------
[INFO] Building deploy
[INFO] task-segment: [assembly:single]
[INFO] ------------------------------------------------------------------------
[INFO] [assembly:single {execution: default-cli}]
[INFO] Processing sources for module project: module1-submodule1:jar:5.5-SNAPSHOT
[INFO] Processing sources for module project: module1-submodule1:jar:5.5-SNAPSHOT
[INFO] Building zip: .../module1/target/module1-5.5-SNAPSHOT-src.zip
[INFO] ------------------------------------------------------------------------
[INFO] Building module1
[INFO] task-segment: [assembly:single]
[INFO] ------------------------------------------------------------------------
[INFO] [assembly:single {execution: default-cli}]
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to create assembly: Error creating assembly archive src: You must set at least one file.
:
-Dexecution.inherited = false
.
-Dassembly.ignoreMissingDescriptor = true
. ?