Maven 2 & 3

<pluginManagement> inheritance problem

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.0-alpha-1
  • Fix Version/s: 2.0-alpha-2
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    1

Description

I have specified a <pluginManagement> section in the parent POM
which is not inherited by the child POM.

The plugin in question is the 'maven-compiler-plugin' which is configured for JDK 1.5 source compatibility.
In the parent POM, this setting is effectuated, but not in the child. When compiling the child, the compiler complains about JDK 1.4+ features in the java source.

A simple test case is attached to reproduce the problem.

The parent POM looks like:

<project>

<name>Parent POM</name>

<groupId>_test</groupId>
<artifactId>parent</artifactId>
<version>1.0</version>
<packaging>pom</packaging>

<modules>
<module>child</module>
</modules>

<build>
<sourceDirectory>src</sourceDirectory>

<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>1.0-alpha-2-SNAPSHOT</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>

And the child, which inherits from the parent:
The <build> section is overridden with a different <sourceDirectory> and, since the <plugins> of the parent gets lost, it is repeated.

<project>

<name>Child POM</name>

<groupId>_test</groupId>
<artifactId>child</artifactId>
<version>1.0</version>
<packaging>pom</packaging>

<parent>
<groupId>_test</groupId>
<artifactId>parent</artifactId>
<version>1.0</version>
</parent>

<build>
<sourceDirectory>src2</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

Issue Links

Activity

Hide
Brett Porter added a comment -

this was fixed by John's changes, and I have made some additional changes so that a plugin definition is never inherited (only plugin management is)

Show
Brett Porter added a comment - this was fixed by John's changes, and I have made some additional changes so that a plugin definition is never inherited (only plugin management is)

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: