mirror of https://github.com/apache/maven.git
[MNG-3743] integration test.
git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@693166 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8907e8cd20
commit
c93cfcc0d6
|
@ -76,6 +76,7 @@ MavenITmng3415JunkRepositoryMetadataTest
|
|||
MavenITmng3645POMSyntaxErrorTest
|
||||
*/
|
||||
|
||||
suite.addTestSuite( MavenITmng3743ForkWithPluginManagementTest.class );
|
||||
suite.addTestSuite( MavenITmng3740SelfReferentialReactorProjectsTest.class );
|
||||
suite.addTestSuite( MavenITmng3729MultiForkAggregatorsTest.class );
|
||||
suite.addTestSuite( MavenITmng3724ExecutionProjectSyncTest.class );
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* 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-3743">MNG-3743</a>.
|
||||
*
|
||||
* @todo Fill in a better description of what this test verifies!
|
||||
*
|
||||
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
|
||||
* @author jdcasey
|
||||
*
|
||||
*/
|
||||
public class MavenITmng3743ForkWithPluginManagementTest
|
||||
extends AbstractMavenIntegrationTestCase
|
||||
{
|
||||
public MavenITmng3743ForkWithPluginManagementTest()
|
||||
throws InvalidVersionSpecificationException
|
||||
{
|
||||
super( "(2.0.8,)" ); // only test in 2.0.9+
|
||||
}
|
||||
|
||||
public void testitMNG3743 ()
|
||||
throws Exception
|
||||
{
|
||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3743-forkWithPluginManagement" );
|
||||
File pluginsDir = new File( testDir, "plugins" );
|
||||
File projectDir = new File( testDir, "project" );
|
||||
|
||||
Verifier verifier = new Verifier( pluginsDir.getAbsolutePath() );
|
||||
verifier.executeGoal( "install" );
|
||||
verifier.verifyErrorFreeLog();
|
||||
verifier.resetStreams();
|
||||
|
||||
verifier = new Verifier( projectDir.getAbsolutePath() );
|
||||
verifier.executeGoal( "site" );
|
||||
verifier.verifyErrorFreeLog();
|
||||
verifier.resetStreams();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project>
|
||||
<parent>
|
||||
<artifactId>plugins</artifactId>
|
||||
<groupId>org.apache.maven.its.mng3743</groupId>
|
||||
<version>1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven.its.mng3743</groupId>
|
||||
<artifactId>maven-mng3743-check-plugin</artifactId>
|
||||
<packaging>maven-plugin</packaging>
|
||||
<name>maven-mng3743-check-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>
|
|
@ -0,0 +1,46 @@
|
|||
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 check
|
||||
*/
|
||||
public class CheckMojo
|
||||
extends AbstractMojo
|
||||
{
|
||||
|
||||
/**
|
||||
* @parameter default-value="false"
|
||||
*/
|
||||
private boolean skipError;
|
||||
|
||||
public void execute()
|
||||
throws MojoExecutionException
|
||||
{
|
||||
if ( !skipError )
|
||||
{
|
||||
throw new MojoExecutionException( "Error should have been skipped using configuration from pluginManagement." );
|
||||
}
|
||||
else
|
||||
{
|
||||
getLog().info( "MNG-3743 check succeeded." );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project>
|
||||
<parent>
|
||||
<artifactId>plugins</artifactId>
|
||||
<groupId>org.apache.maven.its.mng3743</groupId>
|
||||
<version>1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven.its.mng3743</groupId>
|
||||
<artifactId>maven-mng3743-report-plugin</artifactId>
|
||||
<packaging>maven-plugin</packaging>
|
||||
<name>maven-mng3743-report-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>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.reporting</groupId>
|
||||
<artifactId>maven-reporting-impl</artifactId>
|
||||
<version>2.0.4.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,85 @@
|
|||
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 java.io.File;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.maven.doxia.siterenderer.DefaultSiteRenderer;
|
||||
import org.apache.maven.doxia.siterenderer.Renderer;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.reporting.AbstractMavenReport;
|
||||
import org.apache.maven.reporting.MavenReportException;
|
||||
|
||||
/**
|
||||
* Goal which touches a timestamp file.
|
||||
*
|
||||
* @goal report
|
||||
* @execute phase="initialize"
|
||||
*/
|
||||
public class ForkingReport
|
||||
extends AbstractMavenReport
|
||||
{
|
||||
|
||||
/**
|
||||
* @parameter default-value="${project.build.directory}/report"
|
||||
* @readonly
|
||||
*/
|
||||
private File outputDirectory;
|
||||
|
||||
/**
|
||||
* @parameter default-value="${project}"
|
||||
* @readonly
|
||||
*/
|
||||
private MavenProject project;
|
||||
|
||||
protected void executeReport( Locale locale )
|
||||
throws MavenReportException
|
||||
{
|
||||
getLog().info( "MNG-3743 report executed." );
|
||||
}
|
||||
|
||||
protected String getOutputDirectory()
|
||||
{
|
||||
return outputDirectory.getAbsolutePath();
|
||||
}
|
||||
|
||||
protected MavenProject getProject()
|
||||
{
|
||||
return project;
|
||||
}
|
||||
|
||||
protected Renderer getSiteRenderer()
|
||||
{
|
||||
return new DefaultSiteRenderer();
|
||||
}
|
||||
|
||||
public String getDescription( Locale locale )
|
||||
{
|
||||
return "mng3743";
|
||||
}
|
||||
|
||||
public String getName( Locale locale )
|
||||
{
|
||||
return "mng3743";
|
||||
}
|
||||
|
||||
public String getOutputName()
|
||||
{
|
||||
return "mng3743";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project>
|
||||
<parent>
|
||||
<artifactId>plugins</artifactId>
|
||||
<groupId>org.apache.maven.its.mng3743</groupId>
|
||||
<version>1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven.its.mng3743</groupId>
|
||||
<artifactId>mng3743-lifecycle</artifactId>
|
||||
<name>mng3743-lifecycle</name>
|
||||
<version>1</version>
|
||||
<url>http://maven.apache.org</url>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,19 @@
|
|||
<component-set>
|
||||
<components>
|
||||
<component>
|
||||
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
|
||||
<role-hint>mng3743</role-hint>
|
||||
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
|
||||
<configuration>
|
||||
<lifecycles>
|
||||
<lifecycle>
|
||||
<id>default</id>
|
||||
<phases>
|
||||
<initialize>org.apache.maven.its.mng3743:maven-mng3743-check-plugin:check</initialize>
|
||||
</phases>
|
||||
</lifecycle>
|
||||
</lifecycles>
|
||||
</configuration>
|
||||
</component>
|
||||
</components>
|
||||
</component-set>
|
|
@ -0,0 +1,13 @@
|
|||
<?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.mng3743</groupId>
|
||||
<artifactId>plugins</artifactId>
|
||||
<version>1</version>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>maven-mng3743-check-plugin</module>
|
||||
<module>maven-mng3743-report-plugin</module>
|
||||
<module>mng3743-lifecycle</module>
|
||||
</modules>
|
||||
</project>
|
|
@ -0,0 +1,13 @@
|
|||
<?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.mng3743</groupId>
|
||||
<artifactId>mng-3743-forkWithPluginManagement</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name/>
|
||||
<version>1</version>
|
||||
<description/>
|
||||
<modules>
|
||||
<module>plugins</module>
|
||||
</modules>
|
||||
</project>
|
|
@ -0,0 +1,46 @@
|
|||
<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.mng3743</groupId>
|
||||
<artifactId>mng-3743-forkWithPluginManagement</artifactId>
|
||||
<version>1</version>
|
||||
<packaging>mng3743</packaging>
|
||||
|
||||
<name>Integration Test Project for MNG-3743</name>
|
||||
<description>
|
||||
This project verifies that MNG-3743 is fixed. It is controlled by a JUnit test called org.apache.maven.integrationtests.MNG3743Test
|
||||
</description>
|
||||
|
||||
<url>http://jira.codehaus.org/browse/MNG-3743</url>
|
||||
|
||||
<build>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>org.apache.maven.its.mng3743</groupId>
|
||||
<artifactId>mng3743-lifecycle</artifactId>
|
||||
<version>1</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.its.mng3743</groupId>
|
||||
<artifactId>maven-mng3743-check-plugin</artifactId>
|
||||
<configuration>
|
||||
<skipError>true</skipError>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
<reporting>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.its.mng3743</groupId>
|
||||
<artifactId>maven-mng3743-report-plugin</artifactId>
|
||||
<version>1</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
</project>
|
|
@ -0,0 +1,3 @@
|
|||
The problem here is that a plugin that's executed from a forked lifecycle doesn't get the pluginManagement information injected into its configuration. The reason is the lifecycle executor doesn't use the executionProject (the forked lifecycle's version of the project instance) when it verifies the plugin in the plugin manager. This means the pluginManagement information is never injected into the executionProject, but ONLY into the main project instance (for a given POM, I know it's confusing). Later, when the plugin manager tries to use the executionProject to configure the plugin, it's missing critical information from the pluginManagement section.
|
||||
|
||||
This is a particular problem when reports like the javadoc:test-aggregate report runs. This report forks the lifecycle up to the generate-test-sources phase, which includes compile. When the project sources use 1.5 syntax, such as generics, the 1.5 source/target configuration for the compiler plugin isn't injected into the forked lifecycle, and the compile phase fails.
|
Loading…
Reference in New Issue