In a multi-module Maven project, one of the modules is a shaded module (e.g. no source, but generates a jar
during package
phase). Other modules reference this module as a dependency (all under same parent). Is there a way to have Eclipse recognize the shaded module as a dependency? Eclipse only covers up to compile
.
Currently it works on the command line (since package
is run), but in Eclipse it shows errors.
I have not been able to find a solution to this.
Details:
- Parent project
- Module A
- Module B
Module A is a shaded module meaning it has something like:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>shade</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>com.third.party</pattern>
<shadedPattern>my.shaded.third.party</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Module B has Module A as a dependency (under dependencies-dependency). Module B tries to use classes from Module A by importing the relocated paths ...e.g:
import my.shaded.third.party.Foo;
This doesn't work because it can't find Foo. This makes sense since only compile phase is run in Eclipse build.