i have used maven shade plugin in project relocate dependency jar classes under 1 package e.g., org.shade.*
when try use shaded jar in other application maven dependency pulls dependency jar's.
my expectation when uber/shaded jar included maven dependency should not pull other dependent class jar, since classes repackaged within shaded jar.
the classic scenario is:
- a project producing uber-jar has own dependencies (
dependency
elements inpom.xml
file) packaged in 1 uber-jar maven artifact - when using uber-jar dependency (
dependency
element) of project, maven inspect<artifact>-<version>.pom
file (published final artifact maven repository), renamed copy of originalpom.xml
file, dependencies (dependency
element) declared (exactly dependencies packaged uber-jar). since have them packed, ignore
.pom
file (anddependencies
element), need addexclusions
following:<dependency> <groupid>com.sample</groupid> <artifactid>something-uber</artifactid> <version>some-version</version> <exclusions> <exclusion> <groupid>*</groupid> <artifactid>*</artifactid> </exclusion> </exclusions> </dependency>
note: feature above available since maven 3.2.1
.
as such, making clear maven don't want transitive dependency , maven dependency mediation not trigger them.
as side note: not practice have uber-jar dependency of project: make maintenance harder since can't control transitive dependencies via dependencymanagement
or dependencies
order of dependent project. such need re-pack uber jar whenever dependency (one of transitive one) need maintenance (change version , on) , have less control on dependent project (again, harder maintenance).
Comments
Post a Comment