mirror of https://github.com/apache/maven.git
Merged back changes dealing with element ordering.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@750756 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8138048fcf
commit
98891350b8
|
@ -322,27 +322,6 @@ public class PomClassicDomainModel implements InputStreamDomainModel
|
|||
|
||||
modelProperties = ModelMarshaller.marshallXmlToModelProperties(
|
||||
getInputStream(), ProjectUri.baseUri, s );
|
||||
String artifactId = null, groupId = null, version = null;//TODO Expand to full projectId
|
||||
for(ModelProperty mp : modelProperties)
|
||||
{
|
||||
if( mp.getUri().equals(ProjectUri.artifactId))
|
||||
{
|
||||
artifactId = mp.getResolvedValue();
|
||||
}
|
||||
else if( mp.getUri().equals(ProjectUri.groupId))
|
||||
{
|
||||
groupId = mp.getResolvedValue();
|
||||
}
|
||||
else if (mp.getUri().equals(ProjectUri.version))
|
||||
{
|
||||
version = mp.getResolvedValue();
|
||||
}
|
||||
}
|
||||
|
||||
for(ModelProperty mp : modelProperties)
|
||||
{
|
||||
mp.setTag(groupId + ":" + artifactId + ":" + version);
|
||||
}
|
||||
}
|
||||
return new ArrayList<ModelProperty>(modelProperties);
|
||||
}
|
||||
|
|
|
@ -269,7 +269,7 @@ public class PomTransformer
|
|||
if(b.containerAction(c).equals(ModelContainerAction.JOIN))
|
||||
{
|
||||
//MNG-3995 - property lost here
|
||||
joinedContainers.addAll(source.joinWithOriginalOrder(b, c).getProperties());
|
||||
joinedContainers.addAll(source.join(b, c).getProperties());
|
||||
joinedExecutionContainers.add(a);
|
||||
}
|
||||
}
|
||||
|
@ -361,9 +361,10 @@ public class PomTransformer
|
|||
new AlwaysJoinModelContainerFactory()));
|
||||
for(ModelContainer es : executionSource.queryFor( ProjectUri.Build.Plugins.Plugin.Executions.Execution.xUri )) {
|
||||
ExecutionRule rule = new ExecutionRule();
|
||||
System.out.println("----");
|
||||
List<ModelProperty> x = !aContainsAnyOfB(es.getProperties(), joinedContainers) ? es.getProperties() :
|
||||
rule.execute(es.getProperties());
|
||||
// List<ModelProperty> x = rule.execute(es.getProperties());
|
||||
List<ModelProperty> x = !aContainsAnyOfB(es.getProperties(), joinedContainers) ? rule.execute(es.getProperties()) :
|
||||
ModelTransformerContext.sort(rule.execute(es.getProperties()),
|
||||
ProjectUri.Build.Plugins.Plugin.Executions.Execution.xUri);
|
||||
|
||||
dataSource.replace(es, es.createNewInstance(x));
|
||||
}
|
||||
|
@ -410,6 +411,7 @@ public class PomTransformer
|
|||
p.add(mp);
|
||||
}
|
||||
}
|
||||
|
||||
return factory.createDomainModel( p );
|
||||
}
|
||||
|
||||
|
|
|
@ -150,10 +150,6 @@ public final class ArtifactModelContainerFactory
|
|||
}
|
||||
else
|
||||
{
|
||||
for(ModelProperty mp1 : properties)
|
||||
{
|
||||
System.out.println("----" + mp1);
|
||||
}
|
||||
throw new IllegalArgumentException( "Properties do not contain group id. Artifact ID = "
|
||||
+ artifactId + ", Version = " + version );
|
||||
}
|
||||
|
|
|
@ -31,11 +31,11 @@ public class DependencyManagementDataSourceRule implements DataSourceRule
|
|||
|
||||
for(ModelContainer mc : exclusionContainers)
|
||||
{
|
||||
for(ModelContainer mc1 : exclusionContainers.subList(exclusionContainers.indexOf(mc) + 1, exclusionContainers.size()))
|
||||
for(ModelContainer mc1 : exclusionContainers)
|
||||
{
|
||||
if(!mc.equals(mc1) && mc.containerAction(mc1).equals(ModelContainerAction.JOIN))
|
||||
{
|
||||
exclusionSource.join(mc1, mc);
|
||||
exclusionSource.joinWithOriginalOrder(mc1, mc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,21 +36,25 @@ public class ExecutionRule implements ModelContainerRule {
|
|||
} else {
|
||||
x = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
processedProperties.removeAll(c);
|
||||
|
||||
if(!goalProperties.isEmpty()) {
|
||||
Collections.reverse(goalProperties);
|
||||
List<ModelProperty> uniqueGoals = new ArrayList<ModelProperty>();
|
||||
for(ModelProperty mp : goalProperties) {
|
||||
if(!containsProperty(mp, uniqueGoals)) {
|
||||
uniqueGoals.add(mp);
|
||||
}
|
||||
}
|
||||
// Collections.reverse(uniqueGoals);
|
||||
Collections.reverse(uniqueGoals);
|
||||
|
||||
processedProperties.addAll(
|
||||
findIndexOf(ProjectUri.Build.Plugins.Plugin.Executions.Execution.Goals.xURI, processedProperties) + 1,
|
||||
uniqueGoals);
|
||||
uniqueGoals);
|
||||
}
|
||||
|
||||
List<ModelProperty> emptyTags = new ArrayList<ModelProperty>();
|
||||
|
@ -61,13 +65,14 @@ public class ExecutionRule implements ModelContainerRule {
|
|||
}
|
||||
}
|
||||
processedProperties.removeAll(emptyTags);
|
||||
|
||||
return processedProperties;
|
||||
}
|
||||
|
||||
|
||||
private static int findIndexOf(String uri, List<ModelProperty> modelProperties) {
|
||||
for(ModelProperty mp : modelProperties) {
|
||||
if(mp.getUri().equals(uri) && mp.getResolvedValue() == null) {
|
||||
if(mp.getUri().equals(uri)) {
|
||||
return modelProperties.indexOf(mp);
|
||||
}
|
||||
}
|
||||
|
@ -80,6 +85,11 @@ public class ExecutionRule implements ModelContainerRule {
|
|||
boolean b = (mp.getResolvedValue() == null && modelProperty.getResolvedValue() == null) ||
|
||||
(mp.getResolvedValue() != null && !mp.getResolvedValue().trim().equals("")
|
||||
&& mp.getResolvedValue().equals(modelProperty.getResolvedValue()));
|
||||
/*
|
||||
boolean b = (mp.getResolvedValue() == null && modelProperty.getResolvedValue() == null) ||
|
||||
(mp.getResolvedValue() != null && modelProperty.getResolvedValue() != null
|
||||
&& mp.getResolvedValue().equals(modelProperty.getResolvedValue()));
|
||||
*/
|
||||
if(b) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public class OverideConfigTransformerRule implements JoinRule
|
|||
ModelContainerAction action = transformedReportContainer.containerAction( reportContainer );
|
||||
if ( action.equals( ModelContainerAction.JOIN ) )
|
||||
{
|
||||
source.join( reportContainer, transformedReportContainer );
|
||||
source.join( transformedReportContainer, reportContainer );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,21 +90,6 @@ public class PomConstructionTest
|
|||
assertEquals( "test-prop", pom.getValue( "properties[1]/b" ) );//verifies profile applied
|
||||
assertEquals( "test-module", pom.getValue( "modules[1]" ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that modules is not overriden by profile
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
/*
|
||||
public void testPluginManagementDuplicate()
|
||||
throws Exception
|
||||
{
|
||||
PomTestWrapper pom = buildPom( "plugin-management-duplicate");
|
||||
// assertEquals("target", pom.getValue("build/plugins[1]/configuration/domParam/copy/fileset@dir"));
|
||||
System.out.println(pom.getDomainModel().asString());
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Will throw exception if doesn't find parent(s) in build
|
||||
|
@ -130,7 +115,6 @@ public class PomConstructionTest
|
|||
throws Exception
|
||||
{
|
||||
PomTestWrapper pom = buildPom( "plugin-config-properties" );
|
||||
System.out.println(pom.getDomainModel().asString());
|
||||
assertEquals( "my.property", pom.getValue( "build/plugins[1]/configuration[1]/systemProperties[1]/property[1]/name" ) );
|
||||
}
|
||||
|
||||
|
@ -293,7 +277,6 @@ public class PomConstructionTest
|
|||
throws Exception
|
||||
{
|
||||
PomTestWrapper pom = buildPom( "single-configuration-inheritance" );
|
||||
|
||||
assertEquals( 2, ( (List<?>) pom.getValue( "build/plugins[1]/executions[1]/configuration[1]/rules" ) ).size() );
|
||||
assertEquals("2.0.6", pom.getValue( "build/plugins[1]/executions[1]/configuration[1]/rules[1]/requireMavenVersion[1]/version" ) );
|
||||
assertEquals("[2.0.6,)", pom.getValue( "build/plugins[1]/executions[1]/configuration[1]/rules[2]/requireMavenVersion[1]/version" ) );
|
||||
|
|
|
@ -71,7 +71,6 @@ public class PomTestWrapper
|
|||
try {
|
||||
context = JXPathContext.newContext( new MavenXpp3Reader().read(domainModel.getInputStream()));
|
||||
} catch (XmlPullParserException e) {
|
||||
e.printStackTrace();
|
||||
throw new IOException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,51 @@ under the License.
|
|||
-->
|
||||
|
||||
<project>
|
||||
<copy todir="src" overwrite="true">
|
||||
<fileset dir="target" />
|
||||
</copy>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.apache.maven.its.mng4053</groupId>
|
||||
<artifactId>test2</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<name>Maven Integration Test :: MNG-4053</name>
|
||||
<description>
|
||||
Verify that attributes in plugin configuration elements are not erroneously duplicated to other elements when
|
||||
plugin management is used.
|
||||
</description>
|
||||
|
||||
<build>
|
||||
<!-- NOTE: This test used plugin management for the IT plugin -->
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.its.plugins</groupId>
|
||||
<artifactId>maven-it-plugin-configuration</artifactId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.its.plugins</groupId>
|
||||
<artifactId>maven-it-plugin-configuration</artifactId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>config</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<propertiesFile>target/config.properties</propertiesFile>
|
||||
<domParam>
|
||||
<copy todir="src" overwrite="true">
|
||||
<fileset dir="target"/>
|
||||
</copy>
|
||||
</domParam>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
2
pom.xml
2
pom.xml
|
@ -62,7 +62,7 @@ under the License.
|
|||
<plexusJetty6Version>1.6</plexusJetty6Version>
|
||||
<plexusWebdavVersion>1.0</plexusWebdavVersion>
|
||||
<wagonVersion>1.0-beta-4</wagonVersion>
|
||||
<modelBuilderVersion>1.7-SNAPSHOT</modelBuilderVersion>
|
||||
<modelBuilderVersion>1.5</modelBuilderVersion>
|
||||
<mercuryVersion>1.0.0-alpha-4</mercuryVersion>
|
||||
<mercuryMp3Version>1.0-alpha-1</mercuryMp3Version>
|
||||
<securityDispatcherVersion>1.0</securityDispatcherVersion>
|
||||
|
|
Loading…
Reference in New Issue