You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2020/03/28 10:29:39 UTC

[maven] 14/14: Replace checking if the project has the lifecyclePhase "validate" by checking if the project consists in the reactor.

This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch MNG-4660
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 28a6e2cd4a3b12989490a03f725372417cf477ba
Author: Martin Kanters <Ma...@infosupport.com>
AuthorDate: Thu Mar 26 18:09:28 2020 +0100

    Replace checking if the project has the lifecyclePhase "validate" by checking if the project consists in the reactor.
---
 maven-core/src/main/java/org/apache/maven/ReactorReader.java | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/maven-core/src/main/java/org/apache/maven/ReactorReader.java b/maven-core/src/main/java/org/apache/maven/ReactorReader.java
index 0d28a3a..ddc74f7 100644
--- a/maven-core/src/main/java/org/apache/maven/ReactorReader.java
+++ b/maven-core/src/main/java/org/apache/maven/ReactorReader.java
@@ -66,6 +66,8 @@ class ReactorReader
 
     private Logger logger;
 
+    private MavenSession session;
+
     private Map<String, MavenProject> projectsByGAV;
 
     private Map<String, List<MavenProject>> projectsByGA;
@@ -76,6 +78,7 @@ class ReactorReader
     ReactorReader( MavenSession session, Logger logger )
     {
         this.logger = logger;
+        this.session = session;
         this.projectsByGAV = new HashMap<>( session.getAllProjects().size() * 2 );
         session.getAllProjects().forEach( project ->
         {
@@ -196,15 +199,15 @@ class ReactorReader
                 String type = artifact.getProperty( "type", "" );
                 File outputDirectory = new File( project.getBuild().getOutputDirectory() );
 
-                // Check if the target project is being built during this session, and if we can expect any output.
+                // Check if the project is being built during this session, and if we can expect any output.
                 // There is no need to check if the build has created any outputs, see MNG-2222.
                 boolean projectCompiledDuringThisSession
                         = project.hasLifecyclePhase( "compile" ) && COMPILE_PHASE_TYPES.contains( type );
 
-                // Check if the target project lacks 'validate' so we know it's not part of the build at all. If so, we
-                // check if a possible earlier Maven invocation produced some output for that project.
+                // Check if the project is part of the session (not filtered by -pl, -rf, etc). If so, we check
+                // if a possible earlier Maven invocation produced some output for that project which we can use.
                 boolean projectHasOutputFromPreviousSession
-                        = !project.hasLifecyclePhase( "validate" ) && outputDirectory.exists();
+                        = !session.getProjects().contains( project ) && outputDirectory.exists();
 
                 if ( projectHasOutputFromPreviousSession || projectCompiledDuringThisSession )
                 {