Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: 2.0.7
-
Fix Version/s: 2.1.0, 3.0-alpha-1
-
Component/s: Dependencies, Plugins and Lifecycle
-
Labels:None
-
Number of attachments :
Description
In the attached project, you can build module A, then build module B, but the top level aggregator project will fail at B.
The reason this happens is that maven seems to cache plugins. When B is built in isolation, all things are fine - but when built in aggregation, one of the plugins that it uses has already been instantiated, and so it uses that one. This is incorrect, since the declared version is different in B, and is relying on functionality not present in the version declared in A.
I have seen similar behaviour when a plugin relies on other plugins to get work done - all of a sudden a build mysteriously stops working, because of a completely unrelated plugin.
This is pretty painful because
- it's possible to get into a 'no solution', where one project relies on one behaviour so can't upgrade, and one project relies on new behaviour, so can't downgrade.
- you get builds that work OK in isolation, but not in their project. This is bad. Also builds tied together in bigger aggregator projects can fail in mysterious ways (mysterious because the user /has/ specified the plugin version, and maven has ignored them, or it's a plugin dependency that got there first)
- subtle build ordering changes can cause new failures (the example has B depend on A - but the bug might only manifest itself in certain build orders that change even when B and A don't).
Issue Links
- is related to
-
MNG-3013
The plugin manager incorrectly caches plugin versions between embedder calls
-
-
MNG-1024
Reactor does not allow multiple plugin versions across projects
-
-
MNG-1323
Plugin extensions (dependencies) not resolved in reactor build
-
-
MNG-3217
a plugin's dependencies can influence other plugins in a build
-
-
MNG-3801
Plugin dependencies for module ignored when building from aggregated project
-
- relates to
-
MSHITTY-10
install must fix the plugin descriptor version before installing the jar
-
-
MNG-4580
Plugin dependencies for module ignored when building from aggregator project using direct plugin invocation
-
-
MOJO-641
Unable to use alongside latest maven-antrun-plugin due to maven core issue
-
This is an easy-to-reproduce test :
Build the module mojo
Build the module mojo2
then from top level do
mvn install
it should use 2 different versions, you can observe that it only uses one.