Uploaded image for project: 'Archetypes'
  1. Archetypes
  2. ARCH-37

Maven 2 will import the incorrect dependency

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 1.2.1
    • None
    • project
    • None

      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

      • If we copy what is done in the ee-bundle, we can add the following dependency to the parent pom.xml and the webapp will build and run
              <dependency>
                <groupId>info.magnolia</groupId>
                <artifactId>magnolia-module-scheduler</artifactId>
                <version>2.1.2</version>
              </dependency>
        
      • If we make magnolia-ui-project depend on scheduler 2.1.2, the webapp will build and run
      • If we use Maven 3 and delete the above, the webapp will build and run
      • If we use Maven 2 and delete the above, the webapp still builds and runs

      Question

      • Why is the above clause in the pom necessary? What is the Maven 2 bug?

        Acceptance criteria

              gjoseph Magnolia International
              peili.liang Peili Liang
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: