Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-4451

Parametized <groupId/> declarations fail in two level deep multi-module project

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 2.2.1
    • None
    • Bootstrap & Build
    • None
    • Windows XP, JDK 1.6.0_16

    Description

      We utilized the appfuse 2.x multi-module project setup where the modules of the project declare their own <groupId/> value as:

      <groupId>$[pom.parent.groupId].$[pom.parent.artifactId]</groupId>

      (note: replaced the curly braces with brackets due to a wiki error)
      When you add a second level of modules, this approach does not seem to work in Maven. The second level child module, which declares it parent to be a first level child module. It appears that the parameter declaration in the first-level module is ambiguous or is resolving to value as seen by the second-level module. This can be seen below in the output of the error the Maven reactor provides.

      I was able to work around this error by changing the parametized groupId declaration in the first-level module pom and making it explicit. If there is something wrong with this approach or another parametized setting I need to use, please let me know.

      C:\DEV\workspace\parent>mvn clean install
      [INFO] Scanning for projects...
      [INFO] ------------------------------------------------------------------------
      [ERROR] FATAL ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] Error building POM (may not be this project's POM).

      Project ID: com.maventest.parent.first-level:second-level:jar:null

      Reason: Cannot find parent: com.maventest.parent:first-level for project: com.maventest.parent.first-level:second-level:jar:null for project com.maventest.parent.first-level:second-level:jar:null

      [INFO] ------------------------------------------------------------------------
      [INFO] Trace
      org.apache.maven.reactor.MavenExecutionException: Cannot find parent: com.maventest.parent:first-level for project: com.maventest.parent.first-level:second-level:jar:null for project com.maventest.parent.first-level:second-level:jar:null
      at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:404)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:272)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
      at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
      at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
      at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
      at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      Caused by: org.apache.maven.project.ProjectBuildingException: Cannot find parent: com.maventest.parent:first-level for project: com.maventest.parent.first-level:second-level:jar:null for project com.maventest.parent.first-level:second-level:jar:null
      at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1396)
      at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:823)
      at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal(DefaultMavenProjectBuilder.java:508)
      at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:200)
      at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:604)
      at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:487)
      at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:560)
      at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:560)
      at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:391)
      ... 12 more
      Caused by: org.apache.maven.project.ProjectBuildingException: POM 'com.maventest.parent:first-level' not found in repository: Unable to download the artifact from any repository

      com.maventest.parent:first-level:pom:1.0-SNAPSHOT

      from the specified remote repositories:
      central (http://repo1.maven.org/maven2)

      for project com.maventest.parent:first-level
      at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:605)
      at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1392)
      ... 20 more
      Caused by: org.apache.maven.artifact.resolver.ArtifactNotFoundException: Unable to download the artifact from any repository

      com.maventest.parent:first-level:pom:1.0-SNAPSHOT

      from the specified remote repositories:
      central (http://repo1.maven.org/maven2)

      at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:228)
      at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:90)
      at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:558)
      ... 21 more
      Caused by: org.apache.maven.wagon.ResourceDoesNotExistException: Unable to download the artifact from any repository
      at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(DefaultWagonManager.java:404)
      at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:216)
      ... 23 more
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: < 1 second
      [INFO] Finished at: Tue Nov 17 09:57:27 EST 2009
      [INFO] Final Memory: 2M/4M
      [INFO] ------------------------------------------------------------------------

      Attachments

        1. MNG-4451.zip
          2 kB
          Julien HENRY

        Issue Links

          Activity

            People

              bentmann Benjamin Bentmann
              porterhouse91 J. Michael McGarr
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: