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
Community
  • 1
  • 1
Georg Heiler
  • 16,916
  • 36
  • 162
  • 292

1 Answers1

0

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

Georg Heiler
  • 16,916
  • 36
  • 162
  • 292