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

MavenSession.getAllProjects() should return all projects in the reactor

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.3.1, 3.3.3, 3.3.9
    • Fix Version/s: 3.5.0-beta-1, 3.5.0
    • Component/s: None
    • Labels:
      None

      Description

      According to MNG-5582 MavenSession.getAllProjects() should return all projects in the reactor even if the set is constrained by --projects. The current implementation, however, returns the same constrained list that is returned by MavenSession.getProjects().

      This bug seems to have been introduced when MNG-5775 was implemented.

      I came across this bug when I tried to fix an issue in the flatten-maven-plugin. In order to solve the issue a list of all projects in the reactor is needed.

        Issue Links

          Activity

          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user cboehme opened a pull request:

          https://github.com/apache/maven/pull/105

          MNG-6173 MavenSession.getAllProjects() should return all projects in the reactor

          This commit moves the initialisation of the allProjects field in
          MavenSession into the DefaultGraphBuilder as the full list of projects
          in the reactor is only available their.

          Since MavenSessions's projects and projectDependencyGraph fields were
          already initialised in DefaultGraphBuilder, the code that sets them
          again in DefaultMaven is removed.

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/cboehme/maven MNG-6173-get-all-projects

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/maven/pull/105.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #105


          commit 4085c3b568249ed06d78cb4657df462a095ee553
          Author: Christoph Böhme <christoph@b3e.net>
          Date: 2017-02-20T06:32:17Z

          MNG-6173 MavenSession.getAllProjects() should return all projects in the reactor

          This commit moves the initialisation of the allProjects field in
          MavenSession into the DefaultGraphBuilder as the full list of projects
          in the reactor is only available their.

          Since MavenSessions's projects and projectDependencyGraph fields were
          already initialised in DefaultGraphBuilder, the code that sets them
          again in DefaultMaven is removed.


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user cboehme opened a pull request: https://github.com/apache/maven/pull/105 MNG-6173 MavenSession.getAllProjects() should return all projects in the reactor This commit moves the initialisation of the allProjects field in MavenSession into the DefaultGraphBuilder as the full list of projects in the reactor is only available their. Since MavenSessions's projects and projectDependencyGraph fields were already initialised in DefaultGraphBuilder, the code that sets them again in DefaultMaven is removed. You can merge this pull request into a Git repository by running: $ git pull https://github.com/cboehme/maven MNG-6173 -get-all-projects Alternatively you can review and apply these changes as the patch at: https://github.com/apache/maven/pull/105.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #105 commit 4085c3b568249ed06d78cb4657df462a095ee553 Author: Christoph Böhme <christoph@b3e.net> Date: 2017-02-20T06:32:17Z MNG-6173 MavenSession.getAllProjects() should return all projects in the reactor This commit moves the initialisation of the allProjects field in MavenSession into the DefaultGraphBuilder as the full list of projects in the reactor is only available their. Since MavenSessions's projects and projectDependencyGraph fields were already initialised in DefaultGraphBuilder, the code that sets them again in DefaultMaven is removed.
          Hide
          schulte77 Christian Schulte added a comment -

          Would be cool if you could open a pull request against the maven-integration-testing repository providing integration tests for the issue.

          Show
          schulte77 Christian Schulte added a comment - Would be cool if you could open a pull request against the maven-integration-testing repository providing integration tests for the issue.
          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user cboehme opened a pull request:

          https://github.com/apache/maven-integration-testing/pull/19

          MNG-6173 MavenSession.getAllProjects() should return all projects in the reactor

          Integration tests for issue MNG-6173(https://issues.apache.org/jira/browse/MNG-6173) as requested.

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/cboehme/maven-integration-testing MNG-6173-get-all-projects

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/maven-integration-testing/pull/19.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #19


          commit 46e501ef71f5918b79c87056980d4f35f0924490
          Author: Christoph Böhme <christoph@b3e.net>
          Date: 2017-03-03T21:07:17Z

          MNG-6173 getAllProjects() should return all projects

          Adds a test for checking that MavenSession.getAllProjects() returns the full
          list of projects in the reactor even when only some of them are selected
          for being built.

          commit 7b8edbe31c32a4460a254dcd1c8db81587c0df56
          Author: Christoph Böhme <christoph@b3e.net>
          Date: 2017-03-04T07:33:26Z

          MNG-6173 Test getProjects() and getProjectDependencyGraph()

          Adds a test for checking that MavenSession.getProjects() contains the
          projects being built and that MavenSession.getProjectDependencyGraph()
          is set.

          The fix for MNG-6173 changed the way these to properties are
          initialised. This integration test verifies that the initialisation is
          still correct.


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user cboehme opened a pull request: https://github.com/apache/maven-integration-testing/pull/19 MNG-6173 MavenSession.getAllProjects() should return all projects in the reactor Integration tests for issue MNG-6173 ( https://issues.apache.org/jira/browse/MNG-6173 ) as requested. You can merge this pull request into a Git repository by running: $ git pull https://github.com/cboehme/maven-integration-testing MNG-6173 -get-all-projects Alternatively you can review and apply these changes as the patch at: https://github.com/apache/maven-integration-testing/pull/19.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #19 commit 46e501ef71f5918b79c87056980d4f35f0924490 Author: Christoph Böhme <christoph@b3e.net> Date: 2017-03-03T21:07:17Z MNG-6173 getAllProjects() should return all projects Adds a test for checking that MavenSession.getAllProjects() returns the full list of projects in the reactor even when only some of them are selected for being built. commit 7b8edbe31c32a4460a254dcd1c8db81587c0df56 Author: Christoph Böhme <christoph@b3e.net> Date: 2017-03-04T07:33:26Z MNG-6173 Test getProjects() and getProjectDependencyGraph() Adds a test for checking that MavenSession.getProjects() contains the projects being built and that MavenSession.getProjectDependencyGraph() is set. The fix for MNG-6173 changed the way these to properties are initialised. This integration test verifies that the initialisation is still correct.
          Hide
          schulte77 Christian Schulte added a comment -

          Thank you very much. There is a discussion ongoing on dev@. I'll paste the relevant part here so that things can be discussed here.

          Hervé BOUTEMY Sat, 04 Mar 2017 09:55:27 -0800 I have one question, which is recurring for every issue: what is the impact? I understand the logic: it should fix a bug (that is told introduced in Maven 3.3.1), and the bug is explained by the logic behind the javadoc. But no pointer to any code using this method, and that shows that Maven 3.3.1 does not work any more, when previous version were ok. Then what is explained here as a bugfix could cause issues for others. I'm -1 unless I have some details on the impact. Regards, Hervé

          Show
          schulte77 Christian Schulte added a comment - Thank you very much. There is a discussion ongoing on dev@. I'll paste the relevant part here so that things can be discussed here. Hervé BOUTEMY Sat, 04 Mar 2017 09:55:27 -0800 I have one question, which is recurring for every issue: what is the impact? I understand the logic: it should fix a bug (that is told introduced in Maven 3.3.1), and the bug is explained by the logic behind the javadoc. But no pointer to any code using this method, and that shows that Maven 3.3.1 does not work any more, when previous version were ok. Then what is explained here as a bugfix could cause issues for others. I'm -1 unless I have some details on the impact. Regards, Hervé
          Hide
          cboehme Christoph Böhme added a comment -

          Thanks for picking up this issue. I forget to mention why I proposed a fix for the getAllProjects(). I updated the ticket description to explain it. Please let me know if you need more information.

          Show
          cboehme Christoph Böhme added a comment - Thanks for picking up this issue. I forget to mention why I proposed a fix for the getAllProjects() . I updated the ticket description to explain it. Please let me know if you need more information.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

          https://github.com/apache/maven-integration-testing/pull/19

          Show
          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/maven-integration-testing/pull/19
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

          https://github.com/apache/maven/pull/105

          Show
          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/maven/pull/105
          Hide
          schulte77 Christian Schulte added a comment -

          Modified the patch to move MavenSession object initialization out of DefaultGraphBuilder and extended the ProjectDependencyGraph interface to support querying all collected projects.

          Show
          schulte77 Christian Schulte added a comment - Modified the patch to move MavenSession object initialization out of DefaultGraphBuilder and extended the ProjectDependencyGraph interface to support querying all collected projects.
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Jenkins build maven-3.x #1559 (See https://builds.apache.org/job/maven-3.x/1559/)
          MNG-6173 MavenSession.getAllProjects() should return all projects in (schulte: http://git-wip-us.apache.org/repos/asf/?p=maven.git&a=commit&h=114ef6c5a2802e8758e466af92b70f51fd7a2929)

          • (edit) maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
          • (edit) maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java
          • (edit) maven-core/src/main/java/org/apache/maven/graph/FilteredProjectDependencyGraph.java
          • (edit) maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java
          • (edit) maven-core/src/main/java/org/apache/maven/DefaultMaven.java
          • (edit) maven-core/src/main/java/org/apache/maven/graph/DefaultProjectDependencyGraph.java
          • (edit) maven-core/src/main/java/org/apache/maven/execution/ProjectDependencyGraph.java
          • (edit) maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/ProjectDependencyGraphStub.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build maven-3.x #1559 (See https://builds.apache.org/job/maven-3.x/1559/ ) MNG-6173 MavenSession.getAllProjects() should return all projects in (schulte: http://git-wip-us.apache.org/repos/asf/?p=maven.git&a=commit&h=114ef6c5a2802e8758e466af92b70f51fd7a2929 ) (edit) maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java (edit) maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java (edit) maven-core/src/main/java/org/apache/maven/graph/FilteredProjectDependencyGraph.java (edit) maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java (edit) maven-core/src/main/java/org/apache/maven/DefaultMaven.java (edit) maven-core/src/main/java/org/apache/maven/graph/DefaultProjectDependencyGraph.java (edit) maven-core/src/main/java/org/apache/maven/execution/ProjectDependencyGraph.java (edit) maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/ProjectDependencyGraphStub.java

            People

            • Assignee:
              schulte77 Christian Schulte
              Reporter:
              cboehme Christoph Böhme
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development