mirror of https://github.com/apache/maven.git
Fixing problem with mojo configuration merges between parameter configuration keyed by alias and by name within the POM, along with configuration within the MojoDescriptor.
Also adding an IT that will indirectly test that default parameter values are not being disturbed during the merge process. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@232185 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
86321f4163
commit
26de9f77d0
|
@ -131,10 +131,11 @@ it0045: Test non-reactor behavior when plugin declares "@requiresProject false"
|
|||
it0046: Test fail-never reactor behavior. Forces an exception to be thrown in
|
||||
the first module, but checks that the second modules is built.
|
||||
|
||||
it0047: Test the use case for having a compile time dependency be transitive: when you extend a class you need its
|
||||
dependencies at compile time.
|
||||
it0047: Test the use case for having a compile time dependency be transitive:
|
||||
when you extend a class you need its dependencies at compile time.
|
||||
|
||||
it0048: REMOVED. REPLACED WITH UNIT TESTS IN maven-project.
|
||||
it0048: Verify that default values for mojo parameters are working (indirectly,
|
||||
by verifying that the Surefire mojo is functioning correctly).
|
||||
|
||||
it0049: Test parameter alias usage.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
it0049
|
||||
#it0048
|
||||
it0048
|
||||
it0047
|
||||
it0046
|
||||
it0045
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
target/testFileOutput.txt
|
|
@ -0,0 +1 @@
|
|||
test
|
|
@ -0,0 +1,16 @@
|
|||
<model>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core-it0048</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<type>jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</model>
|
|
@ -0,0 +1,16 @@
|
|||
package org.apache.maven.it0001;
|
||||
|
||||
public class Person
|
||||
{
|
||||
private String name;
|
||||
|
||||
public void setName( String name )
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
name = jason
|
|
@ -0,0 +1,40 @@
|
|||
package org.apache.maven.it0001;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import java.net.URL;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
public class PersonTest
|
||||
extends TestCase
|
||||
{
|
||||
public void testPerson() throws IOException
|
||||
{
|
||||
ClassLoader cloader = getClass().getClassLoader();
|
||||
|
||||
String path = getClass().getName().replace( '.', '/' ) + ".class";
|
||||
|
||||
URL resource = cloader.getResource( path );
|
||||
|
||||
File resourceFile = new File( resource.getPath() );
|
||||
|
||||
String dirPath = resourceFile.getAbsolutePath();
|
||||
|
||||
dirPath = dirPath.substring( 0, dirPath.length() - path.length() );
|
||||
|
||||
File dir = new File( dirPath );
|
||||
|
||||
dir = dir.getParentFile();
|
||||
|
||||
File testFile = new File( dir, "testFileOutput.txt" );
|
||||
|
||||
FileWriter writer = new FileWriter( testFile );
|
||||
|
||||
writer.write( "Test" );
|
||||
|
||||
writer.flush();
|
||||
|
||||
writer.close();
|
||||
}
|
||||
}
|
|
@ -865,19 +865,21 @@ public class DefaultPluginManager
|
|||
pomConfig = buildTopDownMergedConfiguration( pomConfig, aliased );
|
||||
}
|
||||
|
||||
boolean addedPomConfig = false;
|
||||
|
||||
if ( pomConfig != null )
|
||||
{
|
||||
pomConfig = buildTopDownMergedConfiguration( pomConfig, mojoConfig );
|
||||
|
||||
// if ( StringUtils.isEmpty( pomConfig.getValue( null ) ) && pomConfig.getChildCount() == 0 )
|
||||
// {
|
||||
// // if we still can't find a value for this parameter, set to ${paramName}
|
||||
// result.setValue( "${" + pomConfig.getName() + "}" );
|
||||
// }
|
||||
|
||||
result.addChild( pomConfig );
|
||||
if ( StringUtils.isNotEmpty( pomConfig.getValue( null ) ) || pomConfig.getChildCount() > 0 )
|
||||
{
|
||||
result.addChild( pomConfig );
|
||||
|
||||
addedPomConfig = true;
|
||||
}
|
||||
}
|
||||
else if ( mojoConfig != null )
|
||||
|
||||
if ( !addedPomConfig && mojoConfig != null )
|
||||
{
|
||||
result.addChild( copyConfiguration( mojoConfig ) );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue