mirror of https://github.com/apache/maven.git
o Decoupled it0081 from production dependencies
git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@707600 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f2d541e28a
commit
5e8e6f2893
|
@ -23,25 +23,28 @@ import org.apache.maven.it.Verifier;
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
public class MavenIT0081Test
|
public class MavenIT0081Test
|
||||||
extends AbstractMavenIntegrationTestCase
|
extends AbstractMavenIntegrationTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test per-plugin dependencies.
|
* Test component injection from project-level plugin dependencies.
|
||||||
*/
|
*/
|
||||||
public void testit0081()
|
public void testit0081()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0081" );
|
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0081" );
|
||||||
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
|
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
|
||||||
verifier.deleteArtifact( "org.apache.maven.its.it0081", "test-plugin", "0.1", "maven-plugin" );
|
verifier.setAutoclean( false );
|
||||||
verifier.executeGoal( "install" );
|
verifier.deleteDirectory( "target" );
|
||||||
verifier.assertFilePresent( "test-component-c/target/org.apache.maven.wagon.providers.ftp.FtpWagon" );
|
verifier.executeGoal( "validate" );
|
||||||
verifier.verifyErrorFreeLog();
|
verifier.verifyErrorFreeLog();
|
||||||
verifier.resetStreams();
|
verifier.resetStreams();
|
||||||
|
|
||||||
|
Properties apiProps = verifier.loadProperties( "target/component.properties" );
|
||||||
|
assertEquals( "true", apiProps.getProperty( "org.apache.maven.its.it0081.DefaultComponent" ) );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,13 +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>
|
<project>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<name>Maven Integration Test :: it0081</name>
|
|
||||||
<groupId>org.apache.maven.its.it0081</groupId>
|
<groupId>org.apache.maven.its.it0081</groupId>
|
||||||
<artifactId>maven-it-it0081</artifactId>
|
<artifactId>test</artifactId>
|
||||||
<description>Test per-plugin dependencies.</description>
|
|
||||||
<version>0.1</version>
|
<version>0.1</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<modules>
|
|
||||||
<module>test-component-c</module>
|
<name>Maven Integration Test :: it0081</name>
|
||||||
<module>test-plugin</module>
|
<description>
|
||||||
</modules>
|
Test component injection from project-level plugin dependencies.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>maven-core-it</id>
|
||||||
|
<url>file:///${basedir}/repo</url>
|
||||||
|
<releases>
|
||||||
|
<checksumPolicy>ignore</checksumPolicy>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<checksumPolicy>ignore</checksumPolicy>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.its.plugins</groupId>
|
||||||
|
<artifactId>maven-it-plugin-class-loader</artifactId>
|
||||||
|
<version>2.1-SNAPSHOT</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>test</id>
|
||||||
|
<phase>validate</phase>
|
||||||
|
<configuration>
|
||||||
|
<className>java.lang.Object</className>
|
||||||
|
<instanceofPropertiesFile>target/component.properties</instanceofPropertiesFile>
|
||||||
|
</configuration>
|
||||||
|
<goals>
|
||||||
|
<goal>instanceof</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<dependencies>
|
||||||
|
<!-- load component into plugin realm -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven.its.it0081</groupId>
|
||||||
|
<artifactId>component</artifactId>
|
||||||
|
<version>0.1</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
|
Binary file not shown.
|
@ -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.it0081</groupId>
|
||||||
|
<artifactId>component</artifactId>
|
||||||
|
<version>0.1</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<distributionManagement>
|
||||||
|
<repository>
|
||||||
|
<id>maven-core-it</id>
|
||||||
|
<url>file:///${basedir}/repo</url>
|
||||||
|
</repository>
|
||||||
|
</distributionManagement>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.test.skip>true</maven.test.skip>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>.</directory>
|
||||||
|
<includes>
|
||||||
|
<include>pom.xml</include>
|
||||||
|
<include>src/**</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
|
<artifactId>plexus-maven-plugin</artifactId>
|
||||||
|
<version>1.3.8</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>create-component-descriptor</id>
|
||||||
|
<phase>generate-resources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>descriptor</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?><metadata>
|
||||||
|
<groupId>org.apache.maven.its.it0081</groupId>
|
||||||
|
<artifactId>component</artifactId>
|
||||||
|
<version>0.1</version>
|
||||||
|
<versioning>
|
||||||
|
<versions>
|
||||||
|
<version>0.1</version>
|
||||||
|
</versions>
|
||||||
|
<lastUpdated>20081024103405</lastUpdated>
|
||||||
|
</versioning>
|
||||||
|
</metadata>
|
|
@ -1,34 +0,0 @@
|
||||||
<project>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<parent>
|
|
||||||
<artifactId>maven-it-it0081</artifactId>
|
|
||||||
<groupId>org.apache.maven.its.it0081</groupId>
|
|
||||||
<version>0.1</version>
|
|
||||||
</parent>
|
|
||||||
<artifactId>test-component-c</artifactId>
|
|
||||||
<version>0.1</version>
|
|
||||||
<name>Test Component C</name>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.its.it0081</groupId>
|
|
||||||
<artifactId>test-plugin</artifactId>
|
|
||||||
<version>0.1</version>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.maven.wagon</groupId>
|
|
||||||
<artifactId>wagon-ftp</artifactId>
|
|
||||||
<version>1.0-alpha-4</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<goals>
|
|
||||||
<goal>test</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
|
|
@ -1,19 +0,0 @@
|
||||||
<project>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<parent>
|
|
||||||
<artifactId>maven-it-it0081</artifactId>
|
|
||||||
<groupId>org.apache.maven.its.it0081</groupId>
|
|
||||||
<version>0.1</version>
|
|
||||||
</parent>
|
|
||||||
<artifactId>test-plugin</artifactId>
|
|
||||||
<packaging>maven-plugin</packaging>
|
|
||||||
<version>0.1</version>
|
|
||||||
<name>Test Plugin</name>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.maven</groupId>
|
|
||||||
<artifactId>maven-plugin-api</artifactId>
|
|
||||||
<version>2.0-beta-1</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
|
@ -1,75 +0,0 @@
|
||||||
package org.apache.maven.plugin.coreit;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright 2001-2004 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;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileWriter;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* test goal.
|
|
||||||
*
|
|
||||||
* @goal test
|
|
||||||
* @phase test
|
|
||||||
*/
|
|
||||||
public class CoreItMojo
|
|
||||||
extends AbstractMojo
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @parameter expression="${project.build.directory}"
|
|
||||||
* @required
|
|
||||||
*/
|
|
||||||
private String outputDirectory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @component role="org.apache.maven.wagon.Wagon" roleHint="ftp"
|
|
||||||
*/
|
|
||||||
private Object wagon;
|
|
||||||
|
|
||||||
public void execute()
|
|
||||||
throws MojoExecutionException
|
|
||||||
{
|
|
||||||
touch( new File( outputDirectory ), wagon.getClass().getName() );
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void touch( File dir, String file )
|
|
||||||
throws MojoExecutionException
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ( !dir.exists() )
|
|
||||||
{
|
|
||||||
dir.mkdirs();
|
|
||||||
}
|
|
||||||
|
|
||||||
File touch = new File( dir, file );
|
|
||||||
|
|
||||||
FileWriter w = new FileWriter( touch );
|
|
||||||
|
|
||||||
w.write( file );
|
|
||||||
|
|
||||||
w.close();
|
|
||||||
}
|
|
||||||
catch ( IOException e )
|
|
||||||
{
|
|
||||||
throw new MojoExecutionException( "Error touching file", e );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue