[ARCH-37] Maven 2 will import the incorrect dependency Created: 05/Aug/14 Updated: 27/Jun/17 Resolved: 07/Aug/14 |
|
| Status: | Closed |
| Project: | Archetypes |
| Component/s: | project |
| Affects Version/s: | None |
| Fix Version/s: | 1.2.1 |
| Type: | Bug | Priority: | Neutral |
| Reporter: | Peili Liang | Assignee: | Magnolia International |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Template: |
|
||||||||
| Acceptance criteria: |
Empty
|
||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
||||||||
| Date of First Response: | |||||||||
| Description |
|
The Problem Use archetype to create a project and a webapp (we select the magnolia-version: 5.3.1, and we change the dependency to ee-bundle after the project is created). The webapp cannot be started and will throw the following exception: Aug 5, 2014 11:46:35 AM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.42 info.magnolia.module.model.reader.ModuleDependencyException: The following exceptions were found while checking Magnolia modules dependencies (i.e. those in META-INF/magnolia/my-module.xml): Module Magnolia RSS Aggregator Module (version 2.3.1) is dependent on scheduler version 2.1.2/*, but Magnolia Scheduler Module (version 2.1.1) is currently installed. 2014-08-05 11:46:41,175 ERROR info.magnolia.init.MagnoliaServletContextListener : Oops, Magnolia could not be started info.magnolia.module.model.reader.ModuleDependencyException: The following exceptions were found while checking Magnolia modules dependencies (i.e. those in META-INF/magnolia/my-module.xml): Module Magnolia RSS Aggregator Module (version 2.3.1) is dependent on scheduler version 2.1.2/*, but Magnolia Scheduler Module (version 2.1.1) is currently installed. The Cause The RSS module should depend the scheduler 2.1.2 in 5.3.1. The following clause in the parent pom.xml of the project created by the archetype, specifically the dependency on magnolia-ui-project which depends on scheduler 2.1.1 seems to causing the conflict in scheduler versions:
<!-- Due to a bug in Maven 2, we have to import info.magnolia:magnolia-project here.
It would normally not be needed, since info.magnolia:magnolia-bundle-parent already imports it. (see below)
The dependency to info.magnolia:magnolia-project needs to be BEFORE the dependency
to info.magnolia:magnolia-bundle-parent, otherwise it doesn't work either.
Also note that this is assuming magnolia-project and magnolia-ui-project have the same version number as
magnolia-bundle-parent, which not always be true in the future.
If you are using Maven 3, you should not need the 2 dependencies below, and all should be well.
-->
<dependency>
<groupId>info.magnolia</groupId>
<artifactId>magnolia-project</artifactId>
<version>${magnoliaVersion}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>info.magnolia.ui</groupId>
<artifactId>magnolia-ui-project</artifactId>
<version>${magnoliaVersion}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Possible Solutions
Question
|
| Comments |
| Comment by Magnolia International [ 05/Aug/14 ] |
|
Hey Peili, The Maven issue only manifests itself when your local maven repo doesn't have the parent poms yet. To check it out: find ~/.m2/repository/info \( -name \*parent -or -name \*project \) -exec rm -rvf {} \;
The Maven bug is https://jira.codehaus.org/browse/MNG-5663 - well, this is a report against 3.2.2, but it also existed in 2.x (but did not find a complete report that said where/when/how it was fixed). The bug is fixed in 3.1.1, 3.2.1 and will be fixed again in 3.2.3 |
| Comment by Magnolia International [ 05/Aug/14 ] |
|
In your case, because of this Maven bug, if you're importing info.magnolia.eebundle:magnolia-enterprise-bundle-parent, you need to also import info.magnolia.bundle:magnolia-bundle-parent (i.e the CE bundle dependencyManagement, just like that bug "forces" you to import magnolia-project and magnolia-ui-project) |
| Comment by Magnolia International [ 07/Aug/14 ] |
|
Updated to comment in the generated pom, hope it clarifies things a bit. |
| Comment by Pierre Sandrin [ 27/Jun/17 ] |
|
I use Maven 3. So removing the two dependencies related to the Maven 2 bug solved the problem for me. Thanks |