Why does the maven-assembly-plugin puts the same dependency in my zip multiple times?
-
21-08-2019 - |
Question
I put together an assembly descriptor
<assembly>
<id>all</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<moduleSets>
<moduleSet>
<includes>
<include>org.openscada.atlantis:org.openscada.atlantis.core.common</include>
<include>org.openscada.atlantis:org.openscada.atlantis.net.base</include>
<include>org.openscada.atlantis:org.openscada.atlantis.core.net.base</include>
... some more ...
<include>org.openscada.atlantis:org.openscada.atlantis.spring.components</include>
</includes>
<binaries>
<includeDependencies>true</includeDependencies>
<outputDirectory>bin</outputDirectory>
<unpack>false</unpack>
<dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>
<useTransitiveFiltering>true</useTransitiveFiltering>
</dependencySet>
</dependencySets>
</binaries>
</moduleSet>
</moduleSets>
</assembly>
nothing special, but now my dependencies are included within the zip file multiple times (the exact same files). Why does this happen, and how can I prevent this? (I thought maybe the use of useTransitiveFiltering would prevent it, but no)
To illustrate how it looks within the zip file here a illustration:
Solution
That is a bug in the assembly plugin. I also noticed that about a year ago. The latest version of the assembly plugin does not have the problem. I would recommend updating the version of the assembly plugin you are using to 2.2 beta 3. It should resolve your issue.
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<version>2.2-beta-3</version>
</plugin>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow