You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2009/08/31 15:03:37 UTC
svn commit: r809571 - in /maven/core-integration-testing/trunk:
core-it-suite/src/test/java/org/apache/maven/it/
core-it-suite/src/test/resources/mng-4332/
core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-resources-plugin/src/main/java/...
Author: bentmann
Date: Mon Aug 31 13:03:37 2009
New Revision: 809571
URL: http://svn.apache.org/viewvc?rev=809571&view=rev
Log:
[MNG-4332] [regression] Default plugin executions contributed by packaging execute after executions from plugin management
o Added IT
Added:
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4332DefaultPluginExecutionOrderTest.java (with props)
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4332/
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4332/pom.xml (with props)
Modified:
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-resources-plugin/src/main/java/org/apache/maven/plugin/coreit/ResourcesMojo.java
Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java?rev=809571&r1=809570&r2=809571&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java (original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java Mon Aug 31 13:03:37 2009
@@ -86,6 +86,7 @@
// 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 );
Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4332DefaultPluginExecutionOrderTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4332DefaultPluginExecutionOrderTest.java?rev=809571&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4332DefaultPluginExecutionOrderTest.java (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4332DefaultPluginExecutionOrderTest.java Mon Aug 31 13:03:37 2009
@@ -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 );
+ }
+
+}
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4332DefaultPluginExecutionOrderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4332DefaultPluginExecutionOrderTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4332/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4332/pom.xml?rev=809571&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4332/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4332/pom.xml Mon Aug 31 13:03:37 2009
@@ -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>
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4332/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4332/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-resources-plugin/src/main/java/org/apache/maven/plugin/coreit/ResourcesMojo.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-resources-plugin/src/main/java/org/apache/maven/plugin/coreit/ResourcesMojo.java?rev=809571&r1=809570&r2=809571&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-resources-plugin/src/main/java/org/apache/maven/plugin/coreit/ResourcesMojo.java (original)
+++ maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-resources-plugin/src/main/java/org/apache/maven/plugin/coreit/ResourcesMojo.java Mon Aug 31 13:03:37 2009
@@ -25,7 +25,9 @@
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.
@@ -57,6 +59,14 @@
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.
*
* @throws MojoExecutionException If the output file could not be created.
@@ -82,8 +92,27 @@
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 )
{