I don't know if this will help, but what I always do is in the parent's pom put the dependencies in a dependencyManagement block;
<dependencyManagement>
<!-- dependencies with exclusions -->
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${version.springframework}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
Then, in the child pom, list the dependencies again, but without the version and exclusions
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</dependency>
But to be honest, for my first and only assembly, I couldn't get it to work in a child module and put it in the parent's pom. Here's my assembly file, for making a zip file for a standalone java program, run by cron:
<?xml version="1.0" encoding="UTF-8"?>
<assembly>
<id>${project.layer}-both</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<baseDirectory>/</baseDirectory>
<moduleSets>
<moduleSet>
<includes>
<include>edu.berkeley.ist.cars:cars_upload</include>
</includes>
<binaries>
<unpack>false</unpack>
<useStrictFiltering>true</useStrictFiltering>
<includeDependencies>true</includeDependencies>
<outputDirectory>upload</outputDirectory>
</binaries>
</moduleSet>
<moduleSet>
<includes>
<include>edu.berkeley.ist.cars:cars_download</include>
</includes>
<binaries>
<unpack>false</unpack>
<useStrictFiltering>true</useStrictFiltering>
<includeDependencies>true</includeDependencies>
<outputDirectory>download</outputDirectory>
</binaries>
</moduleSet>
</moduleSets>
<!--
crontab.txt is put in twice, in both upload and download, just in case.
-->
<files>
<!-- upload files -->
<file>
<source>src/stuff/scripts/cars_upload.sh</source>
<lineEnding>unix</lineEnding>
<filtered>true</filtered>
<outputDirectory>upload</outputDirectory>
</file>
<file>
<source>src/stuff/notes/crontab-${project.layer}.txt</source>
<destName>crontab.txt</destName>
<lineEnding>unix</lineEnding>
<filtered>true</filtered>
<outputDirectory>upload</outputDirectory>
</file>
<!-- download files -->
<file>
<source>src/stuff/scripts/cars_download.sh</source>
<lineEnding>unix</lineEnding>
<filtered>true</filtered>
<outputDirectory>download</outputDirectory>
</file>
<file>
<source>src/stuff/notes/crontab-${project.layer}.txt</source>
<destName>crontab.txt</destName>
<lineEnding>unix</lineEnding>
<filtered>true</filtered>
<outputDirectory>download</outputDirectory>
</file>
</files>
</assembly>
There are two top level directories in the zip file, upload and download.
You can specify the finalName property to give the jar the name you want, and specify that appendAssemblyId should be false to avoid the "jar-with-dependencies" suffix.
The configuration below will output a jar called "test.jar"
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-4</version>
<executions>
<execution>
<id>jar-with-dependencies</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>test</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>
Update: based on your comments, using the built-in descriptor won't work . I believe this is down to a bug in the recent versions of the assembly-plugin - they've removed support for classifiers, but the id is fixed if you use a built-in descriptor, so you end up with a big daft name.
As a workaround, you can copy the assembly descriptor used by the jar-with-dependencies descriptor and modify the id.
This example would result in the assembly id being appended to the finalName, so if you need to have a name of region-full.jar, you can specify the finalName as region and the assembly id as full. This will result in a file in target called region-full.jar, but note it will still be installed to the Maven repository as an attached artifact with full used as the classifier. As long as this id is different to that for your other assembly there should be no collision though.
The pom configuration would look like this.
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-4</version>
<executions>
<execution>
<id>jar-with-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/jar-assembly.xml</descriptor>
</descriptors>
<finalName>region</finalName>
</configuration>
</execution>
</executions>
</plugin>
and the jar-assembly.xml in src/main/assembly like this:
<assembly>
<id>full</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<unpack>true</unpack>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>${project.build.outputDirectory}</directory>
</fileSet>
</fileSets>
</assembly>
Best Answer
Could it be that it is copying transitive dependencies of the WAR?
Try using either
or
in the dependencySet of the WAR.
Assembly Descriptor documentation
If
useTransitiveDependencies
is turned off (it is on by default), the transitive dependencies of the WAR should not be copied.If
useTransitiveFiltering
is turned on (it is off by default), the filters you define will apply to the transitive dependencies of the WAR, and since this is including*:war
should not include any of the dependency JARs when copying.