[ https://issues.apache.org/jira/browse/MENFORCER-257?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Scholte closed MENFORCER-257. ------------------------------------ Fix Version/s: 3.0.0-M4 Resolution: Fixed Fixed in [eadd63210b0d640b0b2b2672d4499a1771ff4052|https://gitbox.apache.org/repos/asf?p=maven-enforcer.git;a=commit;h=eadd63210b0d640b0b2b2672d4499a1771ff4052] > RequireActiveProfile should respect inherited activated profiles > ---------------------------------------------------------------- > > Key: MENFORCER-257 > URL: https://issues.apache.org/jira/browse/MENFORCER-257 > Project: Maven Enforcer Plugin > Issue Type: Improvement > Components: Plugin > Affects Versions: 1.4.1 > Reporter: Stefano Asperti > Assignee: Robert Scholte > Priority: Minor > Fix For: 3.0.0-M4 > > > Active profiles are not inherited from a parent pom, following a proposal to > handle this issue: > From: > {code} > 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; > } > {code} > To: > {code} > @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; > } > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)