Reputation: 131
I'm trying to exclude a series of artifacts when building the uber-jar with the Maven Shade plugin. Below is the configuration I'm using for this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<artifactSet>
<excludes>
<exclude>com.fasterxml.jackson.core:jackson-core:jar:2.4.5</exclude>
</excludes>
</artifactSet>
...
Excluding the package without version information works:
<exclude>com.fasterxml.jackson.core:jackson-core</exclude>
But unfortunately that is not an option because there's a different version of the artifact that does need to be included.
Upvotes: 2
Views: 1706
Reputation: 9374
I think you just need to define which version of jackson you are using.
Obviously that's bad practice when you have same dependencies with different versions (maybe transitive). In this case you could not know which version of this library will end up in your project. You can replace dependencies order in xml and then end result will be different. Doesn't sound good, yes?
So what you need to specify - exact version of jackson in your dependencyManagement section:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
...
This will ensure that you have only specific version in your artifact, and you will not need to exclude specific version.
Hope this helps
Upvotes: 1