mirror of https://github.com/apache/maven.git
[MNG-4332] [regression] Default plugin executions contributed by packaging execute after executions from plugin management
o Added IT git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@809571 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2e768dadce
commit
c00f0b1418
|
@ -86,6 +86,7 @@ public class IntegrationTestSuite
|
|||
// suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class );
|
||||
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
|
||||
|
||||
suite.addTestSuite( MavenITmng4332DefaultPluginExecutionOrderTest.class );
|
||||
suite.addTestSuite( MavenITmng4331DependencyCollectionTest.class );
|
||||
suite.addTestSuite( MavenITmng4328PrimitiveMojoParameterConfigurationTest.class );
|
||||
suite.addTestSuite( MavenITmng4327ExcludeForkingMojoFromForkedLifecycleTest.class );
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
package org.apache.maven.it;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.it.Verifier;
|
||||
import org.apache.maven.it.util.ResourceExtractor;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4332">MNG-4332</a>.
|
||||
*
|
||||
* @author Benjamin Bentmann
|
||||
*/
|
||||
public class MavenITmng4332DefaultPluginExecutionOrderTest
|
||||
extends AbstractMavenIntegrationTestCase
|
||||
{
|
||||
|
||||
public MavenITmng4332DefaultPluginExecutionOrderTest()
|
||||
{
|
||||
super( ALL_MAVEN_VERSIONS );
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that default plugin executions contributed by the packaging are executed before user-defined
|
||||
* executions from the POM's build section, regardless whether the executions are defined in the regular
|
||||
* plugins section or the plugin management section.
|
||||
*/
|
||||
public void testit()
|
||||
throws Exception
|
||||
{
|
||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4332" );
|
||||
|
||||
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
|
||||
verifier.setAutoclean( false );
|
||||
verifier.deleteDirectory( "target" );
|
||||
verifier.executeGoal( "process-resources" );
|
||||
verifier.verifyErrorFreeLog();
|
||||
verifier.resetStreams();
|
||||
|
||||
List lines = verifier.loadLines( "target/resources-resources.txt", "UTF-8" );
|
||||
assertEquals( Arrays.asList( new String[] { "default", "test-1", "test-2" } ), lines );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.apache.maven.its.mng4332</groupId>
|
||||
<artifactId>test</artifactId>
|
||||
<version>0.1</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Maven Integration Test :: MNG-4332</name>
|
||||
<description>
|
||||
Verify that default plugin executions contributed by the packaging are executed before user-defined
|
||||
executions from the POM's build section, regardless whether the executions are defined in the regular
|
||||
plugins section or the plugin management section.
|
||||
</description>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>0.1-stub-SNAPSHOT</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>test-1</id>
|
||||
<goals>
|
||||
<goal>resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<message>test-1</message>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<configuration>
|
||||
<message>default</message>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>test-2</id>
|
||||
<goals>
|
||||
<goal>resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<message>test-2</message>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -25,7 +25,9 @@ import org.apache.maven.plugin.MojoFailureException;
|
|||
import org.apache.maven.project.MavenProject;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
|
||||
/**
|
||||
* Creates a text file in the project base directory.
|
||||
|
@ -56,6 +58,14 @@ public class ResourcesMojo
|
|||
*/
|
||||
private String pathname = "target/resources-resources.txt";
|
||||
|
||||
/**
|
||||
* An optional message line to write to the output file (using UTF-8 encoding). If given, the output file will be
|
||||
* opened in append mode.
|
||||
*
|
||||
* @parameter
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* Runs this mojo.
|
||||
*
|
||||
|
@ -82,8 +92,27 @@ public class ResourcesMojo
|
|||
|
||||
try
|
||||
{
|
||||
outputFile.getParentFile().mkdirs();
|
||||
outputFile.createNewFile();
|
||||
outputFile.getParentFile().mkdirs();
|
||||
|
||||
if ( message != null && message.length() > 0 )
|
||||
{
|
||||
getLog().info( "[MAVEN-CORE-IT-LOG] " + message );
|
||||
|
||||
OutputStreamWriter writer = new OutputStreamWriter( new FileOutputStream( outputFile, true ), "UTF-8" );
|
||||
try
|
||||
{
|
||||
writer.write( message );
|
||||
writer.write( "\n" );
|
||||
}
|
||||
finally
|
||||
{
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
outputFile.createNewFile();
|
||||
}
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue