[ https://issues.apache.org/jira/browse/MENFORCER-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15229054#comment-15229054 ]
Don W Wonders commented on MENFORCER-226: ----------------------------------------- Hello All, I ran into this problem today and believe I've identified why the two plugins report different profile activations. The active profiles plugin first it looks for active profiles using the “m3” approach http://svn.apache.org/viewvc/maven/plugins/tags/maven-help-plugin-2.2/src/main/java/org/apache/maven/plugins/help/ActiveProfilesMojo.java?view=markup#l170 If thats not possible it then falls back to the "m2" approach http://svn.apache.org/viewvc/maven/plugins/tags/maven-help-plugin-2.2/src/main/java/org/apache/maven/plugins/help/ActiveProfilesMojo.java?view=markup#l123 The enforcer requireActiveProfileRule just relies on the "m2" approach http://svn.apache.org/viewvc/maven/enforcer/tags/enforcer-1.4.1/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireActiveProfile.java?view=markup#l144 Not sure if this is a known limitation/issue of the "m2" approach, but the enforcer rule should be able to be updated to use both like the help plugin. Also in the meantime this can be worked around by adding the profile to the child pom with just the <id> and no contents. > requireActiveProfile ignores inherited profiles in submoduless > -------------------------------------------------------------- > > Key: MENFORCER-226 > URL: https://issues.apache.org/jira/browse/MENFORCER-226 > Project: Maven Enforcer Plugin > Issue Type: Bug > Components: Standard Rules > Affects Versions: 1.4 > Environment: Maven 3.2.2, JDK 7, Windows 7 64bit > Reporter: Yago Méndez Vidal > Priority: Minor > Attachments: pom.xml, pom.xml > > > When having a POM project with modules, using the {{requireActiveProfile}} > rule on one of the modules fails to resolve those profiles that are inherited > from the parent. > I've attached 2 POMs to reproduce the problem: > - parent project defines a profile called {{one}} and enforces it to be active > - submodule does nothing, just inherits both > When ran with {{-P one}} parameter we get on the submodule (not the parent > pom, which works fine): > {{\[WARNING\] Rule 0: org.apache.maven.plugins.enforcer.RequireActiveProfile > failed with message:}} > {{Profile "one" is not activated.}} > If we run {{mvn -P one help:active-profiles}} we can observe that the profile > is effectively activated on the submodule: > {{Active Profiles for Project > 'example:-maven-subproject:jar:0.0.1-SNAPSHOT':}} > {{The following profiles are active:}} > {{- default (source: external)}} > {{- one (source: example:test-maven-project:0.0.1-SNAPSHOT)}} -- This message was sent by Atlassian JIRA (v6.3.4#6332)