0

How to properly set up maven-shade plugin in a multi-module maven project setup?

storyline

A (https://github.com/DataSystemsLab/GeoSpark) has a dependency on B (https://github.com/jiayuasu/JTSplus) is a fork of C (com.vividsolutions.jts)

Now for some tasks in my project I need to use D (http://www.geotools.org) which depends on another Version of com.vividsolutions.jts.

How can I use both jars in a single project? A simple dependency replacement unfortunately does not work here. Shading should be the solution.

first attempt - shading the parent pom

When I try to apply the maven-shadeplugin to the root pom of https://github.com/DataSystemsLab/GeoSpark/blob/master/pom.xml as outlined Using Maven shade plugin in a multi module project - NullPointerException a null pointer exception occurs

multi project setup

When following How to configure Maven shade plugin in a multi-module project? to set it up for a multi module build the maven build compiles at least. However, the generated jar is lacking the actual code of the geospark module. I can't see where this would be filtered. My changes are available https://github.com/geoHeil/GeoSpark/commit/23d212aeeeacad8b7199da69366d583fc48edcf0

With the main changes being:

  • introducing a third module FinalModule
  • shading only enabled there replacing com.vividsolutions.jts with com.vividsolutions.jtsgeospark
1
  • I notice when disabling minifiaction of the jar: <!--<minimizeJar>true</minimizeJar>--> the original code is not removed. Includes did not help. Commented May 10, 2017 at 4:34

1 Answer 1

0

Indeed, disabling magnification is the solution. Otherwise probably explicitly including desired artifacts would work as well.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.