Author: jdcasey Date: Thu Aug 28 14:01:52 2008 New Revision: 689981 URL: http://svn.apache.org/viewvc?rev=689981&view=rev Log: [MNG-3729] adding integration test with readme.txt to explain this test, since it's such a complicated one to reproduce.
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3729MultiForkAggregatorsTest.java (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/pom.xml (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/src/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/src/main/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/src/main/java/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/src/main/java/jar/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/src/main/java/jar/Fork1Mojo.java (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/src/main/java/jar/Fork2Mojo.java (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/src/main/java/jar/Plain1Mojo.java (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/projects/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/projects/child1/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/projects/child1/pom.xml (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/projects/pom.xml (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/readme.txt (with props) Modified: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java Modified: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java?rev=689981&r1=689980&r2=689981&view=diff ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java (original) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java Thu Aug 28 14:01:52 2008 @@ -76,6 +76,7 @@ MavenITmng3645POMSyntaxErrorTest */ + suite.addTestSuite( MavenITmng3729MultiForkAggregatorsTest.class ); suite.addTestSuite( MavenITmng3724ExecutionProjectSyncTest.class ); suite.addTestSuite( MavenITmng3723ConcreteParentProjectTest.class ); suite.addTestSuite( MavenITmng3716AggregatorForkingTest.class ); Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3729MultiForkAggregatorsTest.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3729MultiForkAggregatorsTest.java?rev=689981&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3729MultiForkAggregatorsTest.java (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3729MultiForkAggregatorsTest.java Thu Aug 28 14:01:52 2008 @@ -0,0 +1,67 @@ +/* + * 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. + */ + +package org.apache.maven.integrationtests; + +import java.io.File; + +import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; +import org.apache.maven.it.Verifier; +import org.apache.maven.it.util.ResourceExtractor; + +/** + * This is a test set for <a href="http://jira.codehaus.org/browse/MNG-3729">MNG-3729</a>. + * + * @todo Fill in a better description of what this test verifies! + * + * @author <a href="mailto:[EMAIL PROTECTED]">Brian Fox</a> + * @author jdcasey + * + */ +public class MavenITmng3729MultiForkAggregatorsTest + extends AbstractMavenIntegrationTestCase +{ + public MavenITmng3729MultiForkAggregatorsTest() + throws InvalidVersionSpecificationException + { + super( "(2.0.8,)" ); // only test in 2.0.9+ + } + + public void testitMNG3729 () + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3729-multiforkAggregators" ); + File pluginDir = new File( testDir, "maven-mng3729-plugin" ); + File projectDir = new File( testDir, "projects" ); + + Verifier verifier; + + verifier = new Verifier( pluginDir.getAbsolutePath() ); + + verifier.executeGoal( "install" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + verifier = new Verifier( projectDir.getAbsolutePath() ); + + verifier.executeGoal( "package" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + } +} Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3729MultiForkAggregatorsTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/pom.xml URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/pom.xml?rev=689981&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/pom.xml (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/pom.xml Thu Aug 28 14:01:52 2008 @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?><project> + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.maven.its.mng3729</groupId> + <artifactId>maven-mng3729-plugin</artifactId> + <packaging>maven-plugin</packaging> + <name>maven-mng3729-plugin Maven Mojo</name> + <version>1</version> + <url>http://maven.apache.org</url> + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-api</artifactId> + <version>2.0</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> \ No newline at end of file Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/src/main/java/jar/Fork1Mojo.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/src/main/java/jar/Fork1Mojo.java?rev=689981&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/src/main/java/jar/Fork1Mojo.java (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/src/main/java/jar/Fork1Mojo.java Thu Aug 28 14:01:52 2008 @@ -0,0 +1,34 @@ +package jar; + +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed 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.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; + +/** + * @goal fork1 + * @aggregator + * @execute phase="compile" + */ +public class Fork1Mojo + extends AbstractMojo +{ + public void execute() + throws MojoExecutionException + { + } +} Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/src/main/java/jar/Fork1Mojo.java ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/src/main/java/jar/Fork2Mojo.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/src/main/java/jar/Fork2Mojo.java?rev=689981&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/src/main/java/jar/Fork2Mojo.java (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/src/main/java/jar/Fork2Mojo.java Thu Aug 28 14:01:52 2008 @@ -0,0 +1,34 @@ +package jar; + +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed 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.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; + +/** + * @goal fork2 + * @aggregator + * @execute phase="compile" + */ +public class Fork2Mojo + extends AbstractMojo +{ + public void execute() + throws MojoExecutionException + { + } +} Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/src/main/java/jar/Fork2Mojo.java ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/src/main/java/jar/Plain1Mojo.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/src/main/java/jar/Plain1Mojo.java?rev=689981&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/src/main/java/jar/Plain1Mojo.java (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/src/main/java/jar/Plain1Mojo.java Thu Aug 28 14:01:52 2008 @@ -0,0 +1,33 @@ +package jar; + +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed 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.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; + +/** + * @goal plain1 + * @requiresDependencyResolution compile + */ +public class Plain1Mojo + extends AbstractMojo +{ + public void execute() + throws MojoExecutionException + { + } +} Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/maven-mng3729-plugin/src/main/java/jar/Plain1Mojo.java ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/projects/child1/pom.xml URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/projects/child1/pom.xml?rev=689981&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/projects/child1/pom.xml (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/projects/child1/pom.xml Thu Aug 28 14:01:52 2008 @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>projects</artifactId> + <groupId>org.apache.maven.its.mng3729</groupId> + <version>1</version> + </parent> + <groupId>org.apache.maven.its.mng3729</groupId> + <artifactId>child1</artifactId> + <version>1</version> + <packaging>pom</packaging> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.its.mng3729</groupId> + <artifactId>maven-mng3729-plugin</artifactId> + <version>1</version> + <executions> + <execution> + <id>plain-goal</id> + <phase>compile</phase> + <goals> + <goal>plain1</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/projects/child1/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/projects/pom.xml URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/projects/pom.xml?rev=689981&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/projects/pom.xml (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/projects/pom.xml Thu Aug 28 14:01:52 2008 @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.maven.its.mng3729</groupId> + <artifactId>projects</artifactId> + <version>1</version> + <packaging>pom</packaging> + <modules> + <module>child1</module> + </modules> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.its.mng3729</groupId> + <artifactId>maven-mng3729-plugin</artifactId> + <version>1</version> + <executions> + <execution> + <inherited>false</inherited> + <id>fork1</id> + <phase>initialize</phase> + <goals> + <goal>fork1</goal> + </goals> + </execution> + <execution> + <id>fork2</id> + <phase>initialize</phase> + <goals> + <goal>fork2</goal> + </goals> + </execution> + <execution> + <id>plain-goal</id> + <phase>compile</phase> + <goals> + <goal>plain1</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/projects/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/readme.txt URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/readme.txt?rev=689981&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/readme.txt (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/readme.txt Thu Aug 28 14:01:52 2008 @@ -0,0 +1,5 @@ +Complicated use case, but say you have an aggregator plugin that forks a lifecycle, and this aggregator is bound to the main lifecycle in a multimodule build. Further, say you call another plugin directly from the command line for this multimodule build, which forks a new lifecycle (like assembly:assembly). + +When the directly invoked aggregator forks, it will force the forked lifecycle phase to be run for each project in the reactor, regardless of whether this causes the bound aggregator mojo to run multiple times. When the bound aggregator executes for the first project (this will be in an inner fork, two levels removed from the main lifecycle execution) it will set the executionProject to null for the current project (which is one of the reactorProjects member instances). On the second pass, as it tries to execute the inner aggregator's forked lifecycle for the second project in the reactor, one of the reactorProjects' project.getExecutionProject() results will be null. If any of the mojos in this inner lifecycle fork requires dependency resolution, it will cause a NullPointerException in the DefaultPluginManager when it tries to resolve the dependencies for the current project. + +This happened in 2.0.10-RC11 (which was the predecessor to 2.1.0-RC12, since the version was renamed while the release process was in mid-execution). It did not happen in 2.0.9, and was fixed in 2.1.0-RC12. \ No newline at end of file Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3729-multiforkAggregators/readme.txt ------------------------------------------------------------------------------ svn:eol-style = native