mirror of https://github.com/apache/maven.git
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:
parent
c1e21995c9
commit
e4083dcdea
|
@ -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
|
||||
mojo to fail...they will show up as warnings in the -X output instead.
|
||||
|
||||
it0029: Test for pluginManagement injection of plugin configuration.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
- generated sources
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
it0029
|
||||
it0028
|
||||
it0027
|
||||
it0026
|
||||
|
|
|
@ -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>
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
child-project/target/classes/org/apache/maven/it0001/Person.class
|
|
@ -0,0 +1 @@
|
|||
install
|
|
@ -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>
|
|
@ -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}
|
|
@ -23,6 +23,7 @@ import org.apache.maven.model.DependencyManagement;
|
|||
import org.apache.maven.model.DistributionManagement;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.ModelBase;
|
||||
import org.apache.maven.model.PluginManagement;
|
||||
import org.apache.maven.model.Profile;
|
||||
import org.apache.maven.model.ReportPlugin;
|
||||
import org.apache.maven.model.ReportSet;
|
||||
|
@ -483,7 +484,17 @@ public class DefaultModelInheritanceAssembler
|
|||
// Plugin management :: aggregate
|
||||
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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue