Description
Active profiles are not inherited from a parent pom, following a proposal to handle this issue:
From:
protected boolean isProfileActive( MavenProject project, String profileName ) { @SuppressWarnings( "unchecked" ) List<Profile> activeProfiles = project.getActiveProfiles(); if ( activeProfiles != null && !activeProfiles.isEmpty() ) { for ( Profile profile : activeProfiles ) { if ( profile.getId().equals( profileName ) ) { return true; } } } return false; }
To:
@SuppressWarnings("unchecked") protected boolean isProfileActive(MavenProject project, String profileName) { boolean active = false; while(!active && project != null) { active = isProfileActive(project.getActiveProfiles(), profileName); project = project.getParent(); } return active; } protected boolean isProfileActive(List<Profile> activeProfiles, String profileName) { if (activeProfiles != null && !activeProfiles.isEmpty()) { for (Profile profile : activeProfiles) { if (profile.getId().equals(profileName)) { return true; } } } return false; }
Attachments
Issue Links
- is duplicated by
-
MENFORCER-226 requireActiveProfile ignores inherited profiles in submoduless
- Closed