Author: jdcasey
Date: Wed Aug 10 21:38:46 2005
New Revision: 231393
URL: http://svn.apache.org/viewcvs?rev=231393&view=rev
Log:
Resolving: MNG-674
o Added it0049 to prevent further regressions. ;)
Added:
maven/components/trunk/maven-core-it/it0049/
maven/components/trunk/maven-core-it/it0049/expected-results.txt (with
props)
maven/components/trunk/maven-core-it/it0049/goals.txt (with props)
maven/components/trunk/maven-core-it/it0049/pom.xml (with props)
Modified:
maven/components/trunk/maven-core-it-plugin/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java
maven/components/trunk/maven-core-it/README.txt
maven/components/trunk/maven-core-it/integration-tests.txt
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
Modified:
maven/components/trunk/maven-core-it-plugin/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it-plugin/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java?rev=231393&r1=231392&r2=231393&view=diff
==============================================================================
---
maven/components/trunk/maven-core-it-plugin/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java
(original)
+++
maven/components/trunk/maven-core-it-plugin/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java
Wed Aug 10 21:38:46 2005
@@ -59,7 +59,7 @@
private File basedirAlignmentDirectory;
/**
- * @parameter
+ * @parameter alias="pluginFile"
*/
private String pluginItem = "foo";
Modified: maven/components/trunk/maven-core-it/README.txt
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/README.txt?rev=231393&r1=231392&r2=231393&view=diff
==============================================================================
--- maven/components/trunk/maven-core-it/README.txt (original)
+++ maven/components/trunk/maven-core-it/README.txt Wed Aug 10 21:38:46 2005
@@ -134,6 +134,10 @@
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: Test profile overrides of values specified in the pom.
+
+it0049: Test parameter alias usage.
+
-------------------------------------------------------------------------------
- generated sources
Modified: maven/components/trunk/maven-core-it/integration-tests.txt
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/integration-tests.txt?rev=231393&r1=231392&r2=231393&view=diff
==============================================================================
--- maven/components/trunk/maven-core-it/integration-tests.txt (original)
+++ maven/components/trunk/maven-core-it/integration-tests.txt Wed Aug 10
21:38:46 2005
@@ -1,3 +1,5 @@
+it0049
+it0048
it0047
it0046
it0045
Added: maven/components/trunk/maven-core-it/it0049/expected-results.txt
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0049/expected-results.txt?rev=231393&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it0049/expected-results.txt (added)
+++ maven/components/trunk/maven-core-it/it0049/expected-results.txt Wed Aug 10
21:38:46 2005
@@ -0,0 +1 @@
+target/touchFile.txt
Propchange: maven/components/trunk/maven-core-it/it0049/expected-results.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-core-it/it0049/expected-results.txt
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/trunk/maven-core-it/it0049/goals.txt
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0049/goals.txt?rev=231393&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it0049/goals.txt (added)
+++ maven/components/trunk/maven-core-it/it0049/goals.txt Wed Aug 10 21:38:46
2005
@@ -0,0 +1 @@
+core-it:touch
Propchange: maven/components/trunk/maven-core-it/it0049/goals.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-core-it/it0049/goals.txt
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/trunk/maven-core-it/it0049/pom.xml
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0049/pom.xml?rev=231393&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it0049/pom.xml (added)
+++ maven/components/trunk/maven-core-it/it0049/pom.xml Wed Aug 10 21:38:46 2005
@@ -0,0 +1,28 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.it</groupId>
+ <artifactId>maven-it0049</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-core-it-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <configuration>
+ <pluginFile>touchFile.txt</pluginFile>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>plugin-snapshots</id>
+ <name>Plugin Snapshots</name>
+ <url>http://snapshots.maven.codehaus.org/maven2/plugins</url>
+ </pluginRepository>
+ </pluginRepositories>
+</project>
Propchange: maven/components/trunk/maven-core-it/it0049/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-core-it/it0049/pom.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=231393&r1=231392&r2=231393&view=diff
==============================================================================
---
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
(original)
+++
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
Wed Aug 10 21:38:46 2005
@@ -490,7 +490,7 @@
plugin.setLog( mojoLogger );
- PlexusConfiguration pomConfiguration;
+ XmlPlexusConfiguration pomConfiguration;
if ( dom == null )
{
pomConfiguration = new XmlPlexusConfiguration( "configuration" );
@@ -504,8 +504,7 @@
// override in the POM.
validatePomConfiguration( mojoDescriptor, pomConfiguration );
- PlexusConfiguration mergedConfiguration = mergeConfiguration(
pomConfiguration, mojoDescriptor
- .getMojoConfiguration() );
+ PlexusConfiguration mergedConfiguration = mergeMojoConfiguration(
pomConfiguration, mojoDescriptor );
// TODO: plexus changes to make this more like the component
descriptor so this can be used instead
// PlexusConfiguration mergedConfiguration =
mergeConfiguration( pomConfiguration,
@@ -828,6 +827,105 @@
}
}
}
+ }
+
+ private PlexusConfiguration mergeMojoConfiguration( XmlPlexusConfiguration
fromPom, MojoDescriptor mojoDescriptor )
+ {
+ XmlPlexusConfiguration result = new XmlPlexusConfiguration(
fromPom.getName() );
+ result.setValue( fromPom.getValue( null ) );
+
+ PlexusConfiguration fromMojo = mojoDescriptor.getMojoConfiguration();
+
+ for ( Iterator it = mojoDescriptor.getParameters().iterator();
it.hasNext(); )
+ {
+ Parameter parameter = (Parameter) it.next();
+
+ String paramName = parameter.getName();
+ String alias = parameter.getAlias();
+
+ PlexusConfiguration pomConfig = fromPom.getChild( paramName );
+ PlexusConfiguration aliased = null;
+
+ if ( alias != null )
+ {
+ aliased = fromPom.getChild( alias );
+ }
+
+ PlexusConfiguration mojoConfig = fromMojo.getChild( paramName,
false );
+
+ // first we'll merge configurations from the aliased and real
params.
+ // TODO: Is this the right thing to do?
+ if ( aliased != null )
+ {
+ if ( pomConfig == null )
+ {
+ pomConfig = new XmlPlexusConfiguration( paramName );
+ }
+
+ pomConfig = buildTopDownMergedConfiguration( pomConfig,
aliased );
+ }
+
+ 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 );
+ }
+ else if ( mojoConfig != null )
+ {
+ result.addChild( copyConfiguration( mojoConfig ) );
+ }
+ }
+
+ return result;
+ }
+
+ private XmlPlexusConfiguration buildTopDownMergedConfiguration(
PlexusConfiguration dominant, PlexusConfiguration recessive )
+ {
+ XmlPlexusConfiguration result = new XmlPlexusConfiguration(
dominant.getName() );
+
+ String value = dominant.getValue( null );
+
+ if ( StringUtils.isEmpty( value ) && recessive != null )
+ {
+ value = recessive.getValue( null );
+ }
+
+ if ( StringUtils.isNotEmpty( value ) )
+ {
+ result.setValue( value );
+ }
+
+ String[] attributeNames = dominant.getAttributeNames();
+
+ for ( int i = 0; i < attributeNames.length; i++ )
+ {
+ String attributeValue = dominant.getAttribute( attributeNames[i],
null );
+
+ result.setAttribute( attributeNames[i], attributeValue );
+ }
+
+ if ( recessive != null )
+ {
+ attributeNames = recessive.getAttributeNames();
+
+ for ( int i = 0; i < attributeNames.length; i++ )
+ {
+ String attributeValue = recessive.getAttribute(
attributeNames[i], null );
+
+ result.setAttribute( attributeNames[i], attributeValue );
+ }
+
+ mergeConfiguration( result, recessive );
+ }
+
+ return result;
}
private PlexusConfiguration mergeConfiguration( PlexusConfiguration
dominant, PlexusConfiguration configuration )
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]