-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Issue
If the User uses jackson-mapper-asl in his code (f.e. custom invoker), he ends up with 2 versions of jackson-mapper-asl in the /lib directory.
How To Reproduce
create a project
$ mvn archetype:generate -DarchetypeGroupId=com.griddynamics.jagger -DarchetypeArtifactId=jagger-archetype-java-builders -DarchetypeVersion=2.0 -DarchetypeRepository=https://nexus.griddynamics.net/nexus/content/repositories/jagger-releases/
add a dependency in to the pom
./artifact/pom.xml:
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
build the project
$ mvn clean install
see multiple versions of the artifact appears in /lib directory
$ ls -A1 ./artifact/target/artifact-1.0-SNAPSHOT-full/lib/ | grep jackson-mapper
jackson-mapper-asl-1.0.1.jar
jackson-mapper-asl-1.9.13.jar
Expected:
User version is used as it is closer to the maven root.
Actual:
User and Jagger versions are present in final lib.
Temporary workaround
Use "unpackOptions" for the Jagger distribution module in assembly-config.xml
i.e.
<dependencySet>
<outputDirectory>/</outputDirectory>
<includes>
<include>com.griddynamics.jagger:jagger-distribution:zip:full</include>
</includes>
<unpack>true</unpack>
<unpackOptions>
<excludes>
<exclude>**/jackson-mapper-asl-1.0.1*</exclude>
</excludes>
</unpackOptions>
</dependencySet>
RCA
The reason for such behavior is that jagger uses zip in assembly-config.xml to get all dependencies(jars) and resources needed for the execution.
So maven does not know how to compare artifacts from zip, and artifacts from users pom.xml
jackson-mapper-asl-1.0.1 comes from one of the Hadoop dependencies.
Possible Solutions
It will be great to change the build process in a way, that maven can help with dependencies. f.e. copy dependencies not with 'zip', but with 'pom' package.
In this case, User can introduce different plugins to detect duplicate dependencies :)