I have this maven multi-module project :
ModuleA src pom.xml target ModuleA-with-dependencies-shaded.jar (version 4.1 of lucene relocated) ModuleB src pom.xml target ModuleB-with-dependencies.jar (version 7.5.0 of lucene) ModuleDist assembly all.xml pom.xml (shaded plugin for jar + assembly for Docker) The dist pom plugins are configured like this :
<plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>3.2.2</version> <configuration> <shadedClassifierName>all</shadedClassifierName> <shadedArtifactAttached>true</shadedArtifactAttached> <transformers> <!--remove models from jar see mitie --> <transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer"> <resource>.dat</resource> </transformer> </transformers> <artifactSet> <excludes> <exclude>log4j:log4j:jar:</exclude> </excludes> </artifactSet> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> </execution> </executions> </plugin> <plugin> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> <phase>package</phase> <id>make-dist</id> <goals> <goal>single</goal> </goals> <configuration> <descriptors> <descriptor>src/assembly/all.xml</descriptor> </descriptors> </configuration> </execution> </executions> </plugin> And the assembly all.xml :
<assembly> <id>all</id> <formats> <format>dir</format> </formats> <includeBaseDirectory>false</includeBaseDirectory> <fileSets> <fileSet> <directory>${project.basedir}/src/main/docker</directory> <outputDirectory>/</outputDirectory> <includes> <include>*</include> </includes> </fileSet> <fileSet> <directory>${project.build.directory}</directory> <outputDirectory>lib</outputDirectory> <includes> <include>*.jar</include> </includes> </fileSet> </fileSets> </assembly> As the ModuleA is having a transitive dependency on lucene 4.1 (but relocated so it won't clash with moduleB) and ModuleB is having a transitive dependency on lucene 7.5.0, I'd like to use the previously built and shaded jar of ModuleA in the maven shaded plugin of ModuleDist (because if I relocate lucene in ModuleDist it is relocating all lucene classes).
How could I do that ?
or is there another way of doing this ?
<classifier>shaded</classifier>...