Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: 2.0.4
-
Fix Version/s: None
-
Component/s: Inheritance and Interpolation
-
Labels:None
-
Environment:Windows XP, 2K
-
Complexity:Intermediate
Description
Compiler plugin configuration in parent pom profile is ignored by child pom.
Parent pom includes a profile which sets the compiler plugin's source and target settings to 1.5:
<project>
...
<profiles>
<profile>
<id>test</id>
<activation>
<property>
<name>test</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<target>1.5</target>
<source>1.5</source>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
When running the test-compile phase on a child pom, the profile is ignored. Maven complains about annotations not being allowed with -source=1.3.
This occurs when the profile is activated eitherwith the -Ptest or with the -Dtest=true CLI parameters.
The above configuration works perfectly well when the <profiles> element is copied/pasted to the child pom.
Running mvn help:effective-pom (assuming that the child pom has no <profiles> section) shows that the parent's <profiles> section is not inherited. . The last line of the "Introduction to the POM" page says (in broken English):
"NOTE: Profile inheritance the same inheritance strategy as used for the POM itself."
What does this mean?