Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 3.0-beta-3
-
Component/s: Dependencies
-
Labels:None
-
Environment:maven 2.0.10 (tried with dependency plugin 2.0 and 2.1)
-
Complexity:Intermediate
-
Testcase included:yes
-
Number of attachments :2
Description
We added a new dependency (velocity-tools) and the project didn't work any more. We've found that one transitive library (antlr used by struts and hibernate) is missing in the installed WAR file.
It looks like the antlr transitive dependency is ignored from hibernate dependencies by plugin choosing struts-1.2.9 one while eventually struts is replaced by 1.2.7 version which does not have antlr dependency.
There is a workaround to the problem - dependencies might be rearranged to include the missing library back (e.g. by moving struts-1.2.7 from parent to ui but only before velocity-tools - see the test case) however the problem is that the plugin behavior is unpredictable.
Test case:
There are root, parent, common, model, ui POM files. The purpose is to create dependency tree deep enough (ui depends on model and inherits from parent, model depends on common). They include external dependencies (velocity-tools, struts, hibernate).
- WAR artifact created from the root or ui POM does not contain antlr in WEB-INF/lib which is required by hibernate
- after removing velocity-tools from ui/pom.xml antlr library is included properly
-
Hide
- test.zip
- 09/Mar/09 12:08 PM
- 3 kB
- Michal Ropka
-
- test/common/pom.xml 0.6 kB
- test/model/pom.xml 0.6 kB
- test/parent/pom.xml 0.6 kB
- test/pom.xml 0.5 kB
- test/ui/pom.xml 0.9 kB
- test/ui/src/main/webapp/WEB-INF/web.xml 0.0 kB
-
Hide
- test2.zip
- 02/Aug/10 8:47 AM
- 24 kB
- Michal Ropka
-
- test2/common/pom.xml 0.6 kB
- test2/common/target/common-1.jar 1 kB
- test2/common/.../pom.properties 0.1 kB
- test2/lib1-antlr-2/pom.xml 0.6 kB
- test2/lib1-antlr-2/target/lib1-2.jar 1 kB
- test2/lib1-antlr-2/.../pom.properties 0.1 kB
- test2/lib1-nodeps-1/pom.xml 0.5 kB
- test2/lib1-nodeps-1/target/lib1-1.jar 1 kB
- test2/lib1-nodeps-1/.../pom.properties 0.1 kB
- test2/lib2/pom.xml 0.6 kB
- test2/lib2/target/lib2-1.jar 1 kB
- test2/lib2/.../maven-archiver/pom.properties 0.1 kB
- test2/lib3/pom.xml 0.6 kB
- test2/lib3/target/lib3-1.jar 1 kB
- test2/lib3/.../maven-archiver/pom.properties 0.1 kB
- test2/model/pom.xml 0.6 kB
- test2/model/.../pom.properties 0.1 kB
- test2/model/target/model-1.jar 1 kB
- test2/parent/pom.xml 0.6 kB
- test2/pom.xml 0.5 kB
- test2/ui/pom.xml 0.9 kB
- test2/ui/src/main/webapp/WEB-INF/web.xml 0.0 kB
- test2/ui/.../maven-archiver/pom.properties 0.1 kB
- test2/ui/target/ui-1.war 6 kB
- test2/ui/target/.../WEB-INF/lib/common-1.jar 1 kB
- test2/ui/target/.../WEB-INF/lib/lib1-1.jar 1 kB
- test2/ui/target/.../WEB-INF/lib/lib2-1.jar 1 kB
- test2/ui/target/.../WEB-INF/lib/lib3-1.jar 1 kB
- test2/ui/target/.../WEB-INF/lib/model-1.jar 1 kB
- test2/ui/target/ui-1/WEB-INF/web.xml 0.0 kB
Issue Links
Activity
Hi,
I've realized that the test case is not complete as my struts-1.2.7 library is different than deployed in the central repository and it contains no dependencies (was deployed manually before an official release was there) so you couldn't reproduce the problem.
However the problem is still there. I've prepared quickly another example (test2.zip). After installing lib1 (version 1 and 2), lib2 and lib3 and running install in the top project you can see that there is no antlr library in ui/target WAR which is required for lib2 which is there.
Cheers,
Michal
More details:
Dependencies in the files look like:
parent/pom.xml lib1:1 common/pom.xml lib2:1 antlr:antlr:2.7.6 model/pom.xml common ui/pom.xml (parent/pom.xml as parent) model lib3:1 lib1:2 antlr:antlr:2.7.2 top/pom.xml common model ui
While dependency tree in ui
[INFO] ------------------------------------ [INFO] [dependency:tree] [INFO] test:ui:war:1 [INFO] +- test:model:jar:1:compile [INFO] | \- test:common:jar:1:compile [INFO] | \- test.lib:lib2:jar:1:compile [INFO] +- test.lib:lib3:jar:1:compile [INFO] \- test.lib:lib1:jar:1:compile [INFO] ------------------------------------
so lib2 even when requires anrlr does not have it. I believe it is due to some problem when resolving dependencies for lib1.
The dirty tree for the ui modules looks like this:
test:ui:1 +- test:model:1 | \- test:common:1 | \- test.lib:lib2:1 | \- antlr:antlr:2.7.6 <--\ +- test.lib:lib3:1 | | \- test.lib:lib1:2 <--\ |(a) | \- antlr:antlr:2.7.2 |(b) ---/ \- test.lib:lib1:1 ---/
For conflict resolution, Maven basically performs a DFS on this tree. When visiting antlr:2.7.2 it eliminates antlr:2.7.6 (a) and when visiting lib1:1 it eliminates lib1:2 (b). Unfortunately, this last step also eliminates the last path to antlr, i.e. antlr:2.7.6 is not reenabled.
Moving lib1:1 before lib3:1 is a possible workaround for the missing back-tracking in the conflict resolution.
Running "mvn package" on the ui module yields a WAR with the folling contents for me:
i.e. despite the dependency on velocity-tools, antlr is still included. This matches the dependency tree output:
Further things that don't match up with the issue description: The example project does not refer to struts:1.2.9 anywhere. And both struts:1.2.7 and struts:1.2.9 depend on antlr:2.7.2.