You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ma...@apache.org on 2022/11/05 09:30:17 UTC

[maven] branch maven-3.9.x updated: [MNG-7568] Consider inactive profiles for validation

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

martinkanters pushed a commit to branch maven-3.9.x
in repository https://gitbox.apache.org/repos/asf/maven.git


The following commit(s) were added to refs/heads/maven-3.9.x by this push:
     new 8a5dada82 [MNG-7568] Consider inactive profiles for validation
8a5dada82 is described below

commit 8a5dada82c18e08c94b467002fcc08d7b09c5dc2
Author: Piotrek Żygieło <pz...@users.noreply.github.com>
AuthorDate: Mon Oct 24 16:03:00 2022 +0200

    [MNG-7568] Consider inactive profiles for validation
---
 .../src/main/java/org/apache/maven/DefaultMaven.java       | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
index 0fc818e74..68fb64d66 100644
--- a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
+++ b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
@@ -291,11 +291,15 @@ public class DefaultMaven
 
             validatePrerequisitesForNonMavenPluginProjects( session.getProjects() );
 
-            validateActivatedProfiles( session.getProjects(), request.getActiveProfiles() );
+            validateActivatedProfiles( session.getProjects(),
+                    request.getActiveProfiles(),
+                    request.getInactiveProfiles() );
 
             lifecycleStarter.execute( session );
 
-            validateActivatedProfiles( session.getProjects(), request.getActiveProfiles() );
+            validateActivatedProfiles( session.getProjects(),
+                    request.getActiveProfiles(),
+                    request.getInactiveProfiles() );
 
             if ( session.getResult().hasExceptions() )
             {
@@ -468,7 +472,9 @@ public class DefaultMaven
         }
     }
 
-    private void validateActivatedProfiles( List<MavenProject> projects, List<String> activeProfileIds )
+    private void validateActivatedProfiles( List<MavenProject> projects,
+                                            List<String> activeProfileIds,
+                                            List<String> inactiveProfileIds )
     {
         Collection<String> notActivatedProfileIds = new LinkedHashSet<>( activeProfileIds );
 
@@ -480,6 +486,8 @@ public class DefaultMaven
             }
         }
 
+        notActivatedProfileIds.removeAll( inactiveProfileIds );
+
         for ( String notActivatedProfileId : notActivatedProfileIds )
         {
             logger.warn( "The requested profile \"" + notActivatedProfileId