[MNG-4479] [regression] Project-level plugin dependencies ignored for direct CLI invocation if plugin key uses properties

o Added IT

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@887807 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-12-07 00:08:10 +00:00
parent 5656536d57
commit 483438a49b
7 changed files with 270 additions and 0 deletions

View File

@ -86,6 +86,7 @@ public class IntegrationTestSuite
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
suite.addTestSuite( MavenITmng4482ForcePluginSnapshotUpdateTest.class );
suite.addTestSuite( MavenITmng4479ProjectLevelPluginDepUsedForCliConfigTest.class );
suite.addTestSuite( MavenITmng4474PerLookupWagonInstantiationTest.class );
suite.addTestSuite( MavenITmng4470AuthenticatedDeploymentToProxyTest.class );
suite.addTestSuite( MavenITmng4469AuthenticatedDeploymentToCustomRepoTest.class );

View File

@ -0,0 +1,69 @@
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.FileUtils;
import org.apache.maven.it.util.ResourceExtractor;
import java.io.File;
import java.util.Properties;
/**
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4479">MNG-4479</a>.
*
* @author Benjamin Bentmann
*/
public class MavenITmng4479ProjectLevelPluginDepUsedForCliConfigTest
extends AbstractMavenIntegrationTestCase
{
public MavenITmng4479ProjectLevelPluginDepUsedForCliConfigTest()
{
super( "[2.0.3,2.0.99),[3.0-alpha-2,)" );
}
/**
* Verify that project-level plugin dependencies are used for direct invocations of the plugin and that they
* can contribute classes required for the plugin configuration when the plugin is declared using properties
* for its key.
*/
public void testit()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4479" );
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
verifier.deleteDirectory( "target" );
verifier.deleteArtifacts( "org.apache.maven.its.mng4479" );
verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties() );
verifier.getCliOptions().add( "-s" );
verifier.getCliOptions().add( "settings.xml" );
verifier.executeGoal( "org.apache.maven.its.plugins:maven-it-plugin-parameter-implementation:2.1-SNAPSHOT:param-implementation" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
Properties props = verifier.loadProperties( "target/param.properties" );
assertEquals( "org.apache.maven.plugin.coreit.ItImpl-passed", props.getProperty( "theParameter.string" ) );
assertEquals( "org.apache.maven.plugin.coreit.ItImpl", props.getProperty( "theParameter.class" ) );
}
}

View File

@ -0,0 +1,71 @@
<?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.mng4479</groupId>
<artifactId>test</artifactId>
<version>0.1</version>
<packaging>jar</packaging>
<name>Maven Integration Test :: MNG-4479</name>
<description>
Verify that project-level plugin dependencies are used for direct invocations of the plugin and that they
can contribute classes required for the plugin configuration when the plugin is declared using properties
for its key.
</description>
<properties>
<pluginGroupId>org.apache.maven.its.plugins</pluginGroupId>
<pluginArtifactId>maven-it-plugin-parameter-implementation</pluginArtifactId>
</properties>
<build>
<plugins>
<plugin>
<!-- NOTE: It's the essential part of the test to use properties for the plugin key -->
<groupId>${pluginGroupId}</groupId>
<artifactId>${pluginArtifactId}</artifactId>
<version>2.1-SNAPSHOT</version>
<configuration>
<outputFile>target/param.properties</outputFile>
<!-- The implementation class for this parameter needs to be loaded from the dependency below -->
<theParameter implementation="org.apache.maven.plugin.coreit.ItImpl">
<field>passed</field>
</theParameter>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.its.mng4479</groupId>
<artifactId>dep</artifactId>
<version>0.1</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<!-- NOTE: The presence of another plugin declaration is crucial to trigger the bug -->
<artifactId>maven-resources-plugin</artifactId>
<version>2.1</version>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,62 @@
<?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.mng4479</groupId>
<artifactId>dep</artifactId>
<version>0.1</version>
<packaging>jar</packaging>
<name>Maven Integration Test :: MNG-4479 :: Plugin Dependency</name>
<distributionManagement>
<repository>
<id>maven-core-it</id>
<url>file:///${basedir}/repo</url>
</repository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-parameter-implementation</artifactId>
<version>2.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>.</directory>
<includes>
<include>pom.xml</include>
<include>src/**</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
</project>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>org.apache.maven.its.mng4479</groupId>
<artifactId>dep</artifactId>
<version>0.1</version>
<versioning>
<versions>
<version>0.1</version>
</versions>
<lastUpdated>20091206230357</lastUpdated>
</versioning>
</metadata>

View File

@ -0,0 +1,55 @@
<?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.
-->
<settings>
<profiles>
<profile>
<id>maven-core-it-repo</id>
<repositories>
<repository>
<id>maven-core-it</id>
<url>@baseurl@/repo</url>
<releases>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>maven-core-it</id>
<url>@baseurl@/repo</url>
<releases>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>maven-core-it-repo</activeProfile>
</activeProfiles>
</settings>