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:29:36 UTC

[maven] branch maven-3.8.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.8.x
in repository https://gitbox.apache.org/repos/asf/maven.git


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

commit 6bb2a74cbdde8363ed2a84b37e9b7a8591d37db9
Author: Piotrek Żygieło <pz...@users.noreply.github.com>
AuthorDate: Sun Oct 2 14:43:58 2022 +0200

    [MNG-7568] Consider inactive profiles for validation
---
 maven-core/src/main/java/org/apache/maven/DefaultMaven.java | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 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 f487b88fe..bb19527f1 100644
--- a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
+++ b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
@@ -293,7 +293,9 @@ public class DefaultMaven
 
             lifecycleStarter.execute( session );
 
-            validateActivatedProfiles( session.getProjects(), request.getActiveProfiles() );
+            validateActivatedProfiles( session.getProjects(),
+                    request.getActiveProfiles(),
+                    request.getInactiveProfiles() );
 
             if ( session.getResult().hasExceptions() )
             {
@@ -466,7 +468,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 );
 
@@ -478,6 +482,8 @@ public class DefaultMaven
             }
         }
 
+        notActivatedProfileIds.removeAll( inactiveProfileIds );
+
         for ( String notActivatedProfileId : notActivatedProfileIds )
         {
             logger.warn( "The requested profile \"" + notActivatedProfileId