Maven
  1. Maven
  2. MNG-4472

[regression] Circular self-referential POM causes network access

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0-alpha-4
    • Fix Version/s: 3.0-alpha-6
    • Component/s: Reactor and workspace
    • Labels:
      None

      Description

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

      [INFO] Scanning for projects...
      [INFO] ------------------------------------------------------------------------
      [ERROR] FATAL ERROR
      [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:
        org.apache.maven.its.mng:test:pom:0.1
      
      from the specified remote repositories:
        central (http://repo1.maven.org/maven2, releases=true, snapshots=false)
          -> [Help 2]
      [ERROR]
      [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]
      [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

        Activity

        Paul Benedict created issue -
        Paul Benedict made changes -
        Field Original Value New Value
        Description If I were to specify a project with itself as a parent, Maven 2.2.1 gives this response:
        {code}
        [INFO] Scanning for projects...
        [INFO] ------------------------------------------------------------------------
        [ERROR] FATAL ERROR
        [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
        {code}

        Maven 3 doesn't detect this circularity; 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 error condition is no longer detected.
        If I were to specify a project with itself as a parent, Maven 2.2.1 gives this response:
        {code}
        [INFO] Scanning for projects...
        [INFO] ------------------------------------------------------------------------
        [ERROR] FATAL ERROR
        [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
        {code}

        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.

        {code}
        [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:
          org.apache.maven.its.mng:test:pom:0.1

        from the specified remote repositories:
          central (http://repo1.maven.org/maven2, releases=true, snapshots=false)
            -> [Help 2]
        [ERROR]
        [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]
        [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
        {code}
        Paul Benedict made changes -
        Attachment MNG-4472.zip [ 46106 ]
        Paul Benedict made changes -
        Summary [regression] Circular POM not detected [regression] Circular POM causes network access
        Paul Benedict made changes -
        Priority Major [ 3 ] Minor [ 4 ]
        Summary [regression] Circular POM causes network access [regression] Circular self-referential POM causes network access
        Hide
        Benjamin Bentmann added a comment -

        Improved in r885105.

        Show
        Benjamin Bentmann added a comment - Improved in r885105 .
        Benjamin Bentmann made changes -
        Fix Version/s 3.0-alpha-6 [ 15996 ]
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Closed [ 6 ]
        Assignee Benjamin Bentmann [ bentmann ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 08:49:45 UTC 2015 [ 1428223785911 ]
        Mark Thomas made changes -
        Workflow jira [ 12714778 ] Default workflow, editable Closed status [ 12754447 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 21:45:26 UTC 2015 [ 1428270326204 ]
        Mark Thomas made changes -
        Workflow jira [ 12952417 ] Default workflow, editable Closed status [ 12989775 ]
        Mark Thomas made changes -
        Reporter Paul Benedict [ ID134349 ] Paul Benedict [ paul4christ79 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Closed Closed
        13h 26m 1 Benjamin Bentmann 28/Nov/09 10:07

          People

          • Assignee:
            Benjamin Bentmann
            Reporter:
            Paul Benedict
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development