I have a multi-module Maven build where one module shades a library, and another module uses the shared library.
If I run mvn test
, this results in package com.example.shaded.javax.el7 does not exist
.
If I run mvn package test
, the compilation and tests pass.
So what I would like is for the shaded module to not just compile but be shaded (packaged) running maven-shade-plugin:3.2.1:shade
before the dependent module is compiled.
Is it possible to introduce such a target dependency in maven in the pom.xml?
Binding the shade plugin to other phases than package yields this error message:
[ERROR] The project main artifact does not exist. This could have the following
[ERROR] reasons:
[ERROR] - You have invoked the goal directly from the command line. This is not
[ERROR] supported. Please add the goal to the default lifecycle via an
[ERROR] <execution> element in your POM and use "mvn package" to have it run.
[ERROR] - You have bound the goal to a lifecycle phase before "package". Please
[ERROR] remove this binding from your POM such that the goal will be run in
[ERROR] the proper phase.