mirror of https://github.com/apache/maven.git
[MNG-4207] Adding IT plugin that depends on log4j, and integration test to verify non-lightweight http wagon can shade commons-logging and log4j properly
git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@785790 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
13065442f0
commit
40aa2f7a33
|
@ -0,0 +1,54 @@
|
|||
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.util.ResourceExtractor;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4207">MNG-4207</a>.
|
||||
*
|
||||
* @author John Casey
|
||||
*/
|
||||
public class MavenITmng4207PluginWithLog4JTest
|
||||
extends AbstractMavenIntegrationTestCase
|
||||
{
|
||||
|
||||
public MavenITmng4207PluginWithLog4JTest()
|
||||
{
|
||||
super( ALL_MAVEN_VERSIONS );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that exclusions defined on a dependency apply to its transitive dependencies as well.
|
||||
*/
|
||||
public void testit()
|
||||
throws Exception
|
||||
{
|
||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4207" );
|
||||
|
||||
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
|
||||
verifier.executeGoal( "initialize" );
|
||||
verifier.verifyErrorFreeLog();
|
||||
verifier.resetStreams();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
<?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.mngXXXX</groupId>
|
||||
<artifactId>test</artifactId>
|
||||
<version>0.1</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<build>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-webdav-jackrabbit</artifactId>
|
||||
<version>1.0-beta-5</version>
|
||||
</extension>
|
||||
<!--extension>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-http</artifactId>
|
||||
<version>1.0-beta-5</version>
|
||||
</extension-->
|
||||
</extensions>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.its.plugins</groupId>
|
||||
<artifactId>maven-it-plugin-log4j</artifactId>
|
||||
<configuration>
|
||||
<groupId>test</groupId>
|
||||
<artifactId>test</artifactId>
|
||||
<version>1.0</version>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>test</id>
|
||||
<phase>initialize</phase>
|
||||
<goals>
|
||||
<goal>it</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,85 @@
|
|||
<?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 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>maven-it-plugin-core-stubs</artifactId>
|
||||
<groupId>org.apache.maven.its.plugins</groupId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.maven.its.plugins</groupId>
|
||||
<artifactId>maven-it-plugin-log4j</artifactId>
|
||||
<packaging>maven-plugin</packaging>
|
||||
|
||||
<name>Maven Integration Test Plugin :: Log4J Client</name>
|
||||
<description>
|
||||
A test plugin that uses log4j.
|
||||
</description>
|
||||
<inceptionYear>2008</inceptionYear>
|
||||
|
||||
<properties>
|
||||
<maven.test.skip>true</maven.test.skip>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.14</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.2-beta-4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>jar-with-deps</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,109 @@
|
|||
package org.apache.maven.plugin.coreit;
|
||||
|
||||
/*
|
||||
* 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 java.util.*;
|
||||
|
||||
import org.apache.maven.artifact.*;
|
||||
import org.apache.maven.artifact.factory.*;
|
||||
import org.apache.maven.artifact.resolver.*;
|
||||
import org.apache.maven.artifact.repository.*;
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
|
||||
/**
|
||||
* Resolves an artifact and has an (unused) dependency on log4j.
|
||||
*
|
||||
* @goal it
|
||||
*
|
||||
* @author Benjamin Bentmann
|
||||
* @version $Id: CleanMojo.java 698220 2008-09-23 16:18:19Z bentmann $
|
||||
*/
|
||||
public class ItMojo
|
||||
extends AbstractMojo
|
||||
{
|
||||
|
||||
/**
|
||||
* @component
|
||||
*/
|
||||
private ArtifactFactory artifactFactory;
|
||||
|
||||
/**
|
||||
* @component
|
||||
*/
|
||||
private ArtifactResolver artifactResolver;
|
||||
|
||||
/**
|
||||
* @parameter default-value="${localRepository}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private ArtifactRepository localRepository;
|
||||
|
||||
/**
|
||||
* @parameter default-value="${project.remoteArtifactRepositories}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private List remoteRepositories;
|
||||
|
||||
/**
|
||||
* @parameter default-value="test"
|
||||
*/
|
||||
private String groupId;
|
||||
|
||||
/**
|
||||
* @parameter default-value="test"
|
||||
*/
|
||||
private String artifactId;
|
||||
|
||||
/**
|
||||
* @parameter default-value="1.0"
|
||||
*/
|
||||
private String version;
|
||||
|
||||
/**
|
||||
* Runs this mojo.
|
||||
*
|
||||
* @throws MojoExecutionException If the output file could not be created.
|
||||
* @throws MojoFailureException If the output file has not been set.
|
||||
*/
|
||||
public void execute()
|
||||
throws MojoExecutionException
|
||||
{
|
||||
getLog().info( "[MAVEN-CORE-IT-LOG4J]" );
|
||||
|
||||
Artifact artifact = artifactFactory.createProjectArtifact( groupId, artifactId, version );
|
||||
|
||||
try
|
||||
{
|
||||
artifactResolver.resolve( artifact, remoteRepositories, localRepository );
|
||||
}
|
||||
catch ( ArtifactNotFoundException e )
|
||||
{
|
||||
getLog().info( "SUCCESS" );
|
||||
}
|
||||
catch ( ArtifactResolutionException e )
|
||||
{
|
||||
throw new MojoExecutionException( "Should have responded with ArtifactNotFoundException.", e );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -59,6 +59,7 @@ under the License.
|
|||
<module>maven-it-plugin-plexus-utils-11</module>
|
||||
<module>maven-it-plugin-plexus-utils-new</module>
|
||||
<module>maven-it-plugin-plexus-component-api</module>
|
||||
<module>maven-it-plugin-log4j</module>
|
||||
</modules>
|
||||
|
||||
<scm>
|
||||
|
|
Loading…
Reference in New Issue