From 8a5dada82c18e08c94b467002fcc08d7b09c5dc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20=C5=BBygie=C5=82o?= Date: Mon, 24 Oct 2022 16:03:00 +0200 Subject: [PATCH] [MNG-7568] Consider inactive profiles for validation --- .../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 0fc818e748..68fb64d665 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 projects, List activeProfileIds ) + private void validateActivatedProfiles( List projects, + List activeProfileIds, + List inactiveProfileIds ) { Collection notActivatedProfileIds = new LinkedHashSet<>( activeProfileIds ); @@ -480,6 +486,8 @@ public class DefaultMaven } } + notActivatedProfileIds.removeAll( inactiveProfileIds ); + for ( String notActivatedProfileId : notActivatedProfileIds ) { logger.warn( "The requested profile \"" + notActivatedProfileId