mirror of https://github.com/apache/maven.git
MNG-3887: order of plugin executions, MNG-3864: plugin configs are collapsed, MNG-4000: Plugin executions without id are lost
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@737633 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
379f614660
commit
1c2b979977
|
@ -333,19 +333,20 @@ public class PomTransformer
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean hasAtLeastOneWithoutId = true;
|
boolean hasAtLeastOneWithoutId = false;
|
||||||
|
|
||||||
for ( ModelContainer executionContainer : executionContainers )
|
for ( ModelContainer executionContainer : executionContainers )
|
||||||
{
|
{
|
||||||
if ( hasAtLeastOneWithoutId )
|
|
||||||
{
|
|
||||||
hasAtLeastOneWithoutId = hasExecutionId( executionContainer );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !hasAtLeastOneWithoutId && !hasExecutionId( executionContainer ) && executionContainers.indexOf( executionContainer ) > 0 )
|
|
||||||
|
if ( hasAtLeastOneWithoutId && !hasExecutionId( executionContainer ) && executionContainers.indexOf( executionContainer ) > 0 )
|
||||||
{
|
{
|
||||||
removeProperties.addAll( executionContainer.getProperties() );
|
removeProperties.addAll( executionContainer.getProperties() );
|
||||||
}
|
}
|
||||||
|
if ( !hasAtLeastOneWithoutId )
|
||||||
|
{
|
||||||
|
hasAtLeastOneWithoutId = !hasExecutionId( executionContainer );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,16 +363,17 @@ public class PomTransformer
|
||||||
new AlwaysJoinModelContainerFactory()));
|
new AlwaysJoinModelContainerFactory()));
|
||||||
for(ModelContainer es : executionSource.queryFor( ProjectUri.Build.Plugins.Plugin.Executions.Execution.xUri )) {
|
for(ModelContainer es : executionSource.queryFor( ProjectUri.Build.Plugins.Plugin.Executions.Execution.xUri )) {
|
||||||
ExecutionRule rule = new ExecutionRule();
|
ExecutionRule rule = new ExecutionRule();
|
||||||
//List<ModelProperty> x = rule.execute(es.getProperties());
|
List<ModelProperty> x = rule.execute(es.getProperties());
|
||||||
List<ModelProperty> x = (!joinedContainer) ? rule.execute(es.getProperties()) :
|
// List<ModelProperty> x = (!joinedContainer) ? rule.execute(es.getProperties()) :
|
||||||
ModelTransformerContext.sort(rule.execute(es.getProperties()),
|
// ModelTransformerContext.sort(rule.execute(es.getProperties()),
|
||||||
ProjectUri.Build.Plugins.Plugin.Executions.Execution.xUri);
|
// ProjectUri.Build.Plugins.Plugin.Executions.Execution.xUri);
|
||||||
|
|
||||||
dataSource.replace(es, es.createNewInstance(x));
|
dataSource.replace(es, es.createNewInstance(x));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
props = dataSource.getModelProperties();
|
props = joinedContainer ? ModelTransformerContext.sort(dataSource.getModelProperties(), ProjectUri.baseUri)
|
||||||
|
: dataSource.getModelProperties();
|
||||||
|
|
||||||
for(ModelEventListener listener : eventListeners)
|
for(ModelEventListener listener : eventListeners)
|
||||||
{
|
{
|
||||||
|
|
|
@ -111,7 +111,9 @@ public class PomConstructionTest
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
PomTestWrapper pom = buildPom( "execution-configuration" );
|
PomTestWrapper pom = buildPom( "execution-configuration" );
|
||||||
assertEquals( 2, ( (List<?>) pom.getValue( "build/plugins[1]/executions[1]/configuration" ) ).size() );
|
assertEquals( 2, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() );
|
||||||
|
assertEquals( "src/main/mdo/nexus.xml", ( pom.getValue( "build/plugins[1]/executions[1]/configuration[1]/model" ) ));
|
||||||
|
assertEquals( "src/main/mdo/security.xml", ( pom.getValue( "build/plugins[1]/executions[2]/configuration[1]/model" ) ));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSingleConfigurationInheritance()
|
public void testSingleConfigurationInheritance()
|
||||||
|
@ -128,8 +130,8 @@ public class PomConstructionTest
|
||||||
{
|
{
|
||||||
PomTestWrapper pom = buildPom( "config-with-plugin-mng" );
|
PomTestWrapper pom = buildPom( "config-with-plugin-mng" );
|
||||||
assertEquals( 2, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() );
|
assertEquals( 2, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() );
|
||||||
assertEquals( "src/main/mdo/security.xml", pom.getValue( "build/plugins[1]/executions[1]/configuration[1]/model" ) );
|
assertEquals( "src/main/mdo/security.xml", pom.getValue( "build/plugins[1]/executions[2]/configuration[1]/model" ) );
|
||||||
assertEquals( "1.0.8", pom.getValue( "build/plugins[1]/executions[2]/configuration[1]/version" ) );
|
assertEquals( "1.0.8", pom.getValue( "build/plugins[1]/executions[1]/configuration[1]/version" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/** MNG-3965 */
|
/** MNG-3965 */
|
||||||
|
@ -145,7 +147,7 @@ public class PomConstructionTest
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
PomTestWrapper pom = buildPom( "foo/sub" );
|
PomTestWrapper pom = buildPom( "foo/sub" );
|
||||||
System.out.println(pom.getDomainModel().asString());
|
//System.out.println(pom.getDomainModel().asString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** MNG-3985 */
|
/** MNG-3985 */
|
||||||
|
@ -211,7 +213,7 @@ public class PomConstructionTest
|
||||||
assertEquals( "e", pom.getValue( "build/plugins[1]/executions[5]/id" ) );
|
assertEquals( "e", pom.getValue( "build/plugins[1]/executions[5]/id" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: cf. MNG-3887
|
/* FIXME: cf. MNG-3887 */
|
||||||
public void testOrderOfPluginExecutionsWithPluginManagement()
|
public void testOrderOfPluginExecutionsWithPluginManagement()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -315,7 +317,7 @@ public class PomConstructionTest
|
||||||
{
|
{
|
||||||
PomTestWrapper pom = buildPom( "plugin-exec-merging/wo-plugin-mngt/sub" );
|
PomTestWrapper pom = buildPom( "plugin-exec-merging/wo-plugin-mngt/sub" );
|
||||||
assertEquals( 2, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() );
|
assertEquals( 2, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() );
|
||||||
assertEquals( "child-default", pom.getValue( "build/plugins[1]/executions[@id='default']/phase" ) );
|
assertEquals( "child-default", pom.getValue( "build/plugins[1]/executions[@id='default-execution-id']/phase" ) );
|
||||||
assertEquals( "child-non-default", pom.getValue( "build/plugins[1]/executions[@id='non-default']/phase" ) );
|
assertEquals( "child-non-default", pom.getValue( "build/plugins[1]/executions[@id='non-default']/phase" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -514,7 +516,7 @@ public class PomConstructionTest
|
||||||
assertEquals( "four", pom.getValue( "build/plugins[1]/configuration/stringParams/stringParam[4]" ) );
|
assertEquals( "four", pom.getValue( "build/plugins[1]/configuration/stringParams/stringParam[4]" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: cf. MNG-3827
|
/* FIXME: cf. MNG-3827*/
|
||||||
public void testOrderOfPluginConfigurationElementsWithPluginManagement()
|
public void testOrderOfPluginConfigurationElementsWithPluginManagement()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -539,7 +541,7 @@ public class PomConstructionTest
|
||||||
assertEquals( "key2", pom.getValue( prefix + "propertiesParam/property[2]/name" ) );
|
assertEquals( "key2", pom.getValue( prefix + "propertiesParam/property[2]/name" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: cf. MNG-3864
|
/* FIXME: cf. MNG-3864*/
|
||||||
public void testOrderOfPluginExecutionConfigurationElementsWithPluginManagement()
|
public void testOrderOfPluginExecutionConfigurationElementsWithPluginManagement()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -598,7 +600,7 @@ public class PomConstructionTest
|
||||||
}
|
}
|
||||||
//*/
|
//*/
|
||||||
|
|
||||||
/* FIXME: cf. MNG-4000
|
/* FIXME: cf. MNG-4000 */
|
||||||
public void testMultiplePluginExecutionsWithAndWithoutIdsWithoutPluginManagement()
|
public void testMultiplePluginExecutionsWithAndWithoutIdsWithoutPluginManagement()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,7 +45,7 @@ under the License.
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<!-- NOTE: Explicitly reference "default" id here -->
|
<!-- NOTE: Explicitly reference "default" id here -->
|
||||||
<id>default</id>
|
<id>default-execution-id</id>
|
||||||
<phase>child-default</phase>
|
<phase>child-default</phase>
|
||||||
</execution>
|
</execution>
|
||||||
<execution>
|
<execution>
|
||||||
|
|
Loading…
Reference in New Issue