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

[regression] Circular self-referential POM causes network access



    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.0-alpha-4
    • 3.0-alpha-6
    • Reactor and Workspace
    • None


      If I were to specify a project with itself as a parent, Maven 2.2.1 gives this response:

      [INFO] Scanning for projects...
      [INFO] ------------------------------------------------------------------------
      [INFO] ------------------------------------------------------------------------
      [INFO] Error building POM (may not be this project's POM).
      Project ID: org.apache.maven.its.mng:test
      Reason: Parent element is a duplicate of the current project  for project org.apache.maven.its.mng:test
      [INFO] ------------------------------------------------------------------------
      [INFO] Trace
      org.apache.maven.reactor.MavenExecutionException: Parent element is a duplicate of the current project  for project org.apache.maven.its.mng:test
              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: Parent element is a duplicate of the current project  for project org.apache.maven.its.mng:test

      Maven 3 doesn't detect this circularity immediately; it tries to download the parent by going through my remote repositories. The end result is still a failure since it can't find itself, but it's a regression since the network is accessed for this use case.

      [INFO] Scanning for projects...
      Downloading: http://repo1.maven.org/maven2/org/apache/maven/its/mng/test/0.1/test-0.1.pom
      [ERROR] The build could not read 1 project -> [Help 1]
      [ERROR]   The project org.apache.maven.its.mng:test:0.1 (D:\patches\MNG-4472\pom.xml) has 2 errors
      [ERROR]     The parent element cannot have the same ID as the project.
      [ERROR]     Non-resolvable parent POM org.apache.maven.its.mng:test:0.1 for org.apache.maven.its.mng:test:0.1: Failed to resolve POM for org.apache.maven.its.mng:test:0.1 due to Missing:
      1) org.apache.maven.its.mng:test:pom:0.1
      1 required artifact is missing.
      for artifact:
      from the specified remote repositories:
        central (http://repo1.maven.org/maven2, releases=true, snapshots=false)
          -> [Help 2]
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
      [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException


        1. MNG-4472.zip
          0.9 kB
          Paul Benedict



            bentmann Benjamin Bentmann
            pbenedict Paul Benedict
            0 Vote for this issue
            0 Start watching this issue