[MNG-7568] Consider inactive profiles for validation

This commit is contained in:
Piotrek Żygieło 2022-10-24 16:03:00 +02:00 committed by Martin Kanters
parent 3212efee78
commit 8a5dada82c
1 changed files with 11 additions and 3 deletions

View File

@ -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