You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a multi-module build, due to the use of requiresDependencyResolution = ResolutionScope.TEST, it is impossible to reliably use the plugin before the install phase of dependant modules in the same project. This can be a problem when using the plugin in the clean phase where it can be useful to clean up external resources that are created by the plugin in other phases.
The error happens when building a snapshot version for the first time where intra-project dependencies might not yet exist. When triggering the maven-exec-plugin, Maven will attempt to resolve the dependencies for the module where no dependent package was yet created before the package phase. Therefore, dependency resolution will fail. This is independant of the dependencies being required by the plugin.
As a possible work around, one could create a subclass without any code of its own such as:
This way, one could use the plugin in the clean phase.
Such a solution would remedy the issue of people often using mvn clean package even on a fresh project where any clone with subsequent build results in an error.
The text was updated successfully, but these errors were encountered:
raphw
changed the title
Build failure when used in "clean" scope
Build failure when used in "clean" scope in fresh build
Nov 28, 2019
@raphw thanks.
This kind of multi-module issue is making me go crazy.
It's much more noticeable when you run a CI pipeline.
If you start with projects a and b, and then you deliver c, making b dependent on it, you'll have to run mvn install again.
At this point you'll end up with a pipeline which always uses install, wasting time for nothing.
In a multi-module build, due to the use of
requiresDependencyResolution = ResolutionScope.TEST
, it is impossible to reliably use the plugin before the install phase of dependant modules in the same project. This can be a problem when using the plugin in the clean phase where it can be useful to clean up external resources that are created by the plugin in other phases.The error happens when building a snapshot version for the first time where intra-project dependencies might not yet exist. When triggering the maven-exec-plugin, Maven will attempt to resolve the dependencies for the module where no dependent package was yet created before the package phase. Therefore, dependency resolution will fail. This is independant of the dependencies being required by the plugin.
As a possible work around, one could create a subclass without any code of its own such as:
This way, one could use the plugin in the
clean
phase.Such a solution would remedy the issue of people often using
mvn clean package
even on a fresh project where any clone with subsequent build results in an error.The text was updated successfully, but these errors were encountered: