Resolving issue: MNG-522

o Added check for null child pluginManagement section, and setting to parent value if null.
o Added integration test for parent->child pluginManagement inheritance and injection, to prevent regressions.



git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@201693 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-06-25 00:00:05 +00:00
parent c1e21995c9
commit e4083dcdea
9 changed files with 104 additions and 1 deletions

View File

@ -88,6 +88,8 @@ it0027: Test @execute with a custom lifecycle, including configuration
it0028: Test that unused configuration parameters from the POM don't cause the it0028: Test that unused configuration parameters from the POM don't cause the
mojo to fail...they will show up as warnings in the -X output instead. mojo to fail...they will show up as warnings in the -X output instead.
it0029: Test for pluginManagement injection of plugin configuration.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
- generated sources - generated sources

View File

@ -1,3 +1,4 @@
it0029
it0028 it0028
it0027 it0027
it0026 it0026

View File

@ -0,0 +1,29 @@
<model>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.maven.it</groupId>
<artifactId>maven-core-it0030</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.maven.it</groupId>
<artifactId>maven-core-it0030-child</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<type>jar</type>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
</plugins>
</build>
</model>

View File

@ -0,0 +1,18 @@
package org.apache.maven.it0001;
public class Person
{
private String name;
public void setName( String newName )
{
assert true;
this.name = newName;
}
public String getName()
{
return name;
}
}

View File

@ -0,0 +1 @@
child-project/target/classes/org/apache/maven/it0001/Person.class

View File

@ -0,0 +1 @@
install

View File

@ -0,0 +1,38 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.it</groupId>
<artifactId>maven-core-it0030</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>child-project</module>
</modules>
<build>
<!-- plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.4</source>
<target>1.4</target>
</configuration>
</plugin>
</plugins -->
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.4</source>
<target>1.4</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

View File

@ -0,0 +1,2 @@
rm ${artifact:org.apache.maven.it:maven-core-it0029:1.0-SNAPSHOT:jar}
rm ${artifact:org.apache.maven.it:maven-core-it0029-child:1.0-SNAPSHOT:jar}

View File

@ -23,6 +23,7 @@ import org.apache.maven.model.DependencyManagement;
import org.apache.maven.model.DistributionManagement; import org.apache.maven.model.DistributionManagement;
import org.apache.maven.model.Model; import org.apache.maven.model.Model;
import org.apache.maven.model.ModelBase; import org.apache.maven.model.ModelBase;
import org.apache.maven.model.PluginManagement;
import org.apache.maven.model.Profile; import org.apache.maven.model.Profile;
import org.apache.maven.model.ReportPlugin; import org.apache.maven.model.ReportPlugin;
import org.apache.maven.model.ReportSet; import org.apache.maven.model.ReportSet;
@ -483,7 +484,17 @@ public class DefaultModelInheritanceAssembler
// Plugin management :: aggregate // Plugin management :: aggregate
if ( childBuild != null && parentBuild != null ) if ( childBuild != null && parentBuild != null )
{ {
ModelUtils.mergePluginLists( childBuild.getPluginManagement(), parentBuild.getPluginManagement(), false ); PluginManagement childPM = childBuild.getPluginManagement();
PluginManagement parentPM = parentBuild.getPluginManagement();
if( childPM == null && parentPM !=null )
{
childBuild.setPluginManagement( parentPM );
}
else
{
ModelUtils.mergePluginLists( childBuild.getPluginManagement(), parentBuild.getPluginManagement(), false );
}
} }
} }