mirror of https://github.com/apache/maven.git
Adding new IT to try to test MCHECKSTYLE-10.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@367788 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0bb2300dde
commit
636d54c0a8
|
@ -234,12 +234,16 @@ it0085: Verify that system-scoped dependencies get resolved with system scope
|
|||
dependency. Inherited scope should not apply in the case of
|
||||
system-scoped dependencies, no matter where they are.
|
||||
|
||||
it0086: Verify that a class in a plugin's dependencies can be loaded by both
|
||||
<plugin>.getClass().getClassLoader() and Thread.currentThread().getContextClassLoader().
|
||||
it0086: Verify that a plugin dependency class can be loaded from both the plugin classloader and the
|
||||
context classloader available to the plugin.
|
||||
|
||||
it0087: Verify that a class in the project-level dependencies for a plugin can be loaded by both
|
||||
<plugin>.getClass().getClassLoader() and Thread.currentThread().getContextClassLoader().
|
||||
it0087: Verify that a project-level plugin dependency class can be loaded from both the plugin classloader
|
||||
and the context classloader available to the plugin.
|
||||
|
||||
it0088: Test path translation
|
||||
|
||||
it0089: Test that Checkstyle PackageNamesLoader.loadModuleFactory(..) method will complete as-is with
|
||||
the context classloader available to the plugin.
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
- generated sources
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
it0089
|
||||
it0088
|
||||
it0087
|
||||
it0086
|
||||
it0085
|
||||
it0084
|
||||
it0083
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
project/target/output.txt
|
|
@ -0,0 +1 @@
|
|||
install
|
|
@ -0,0 +1,26 @@
|
|||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.apache.maven.it</groupId>
|
||||
<version>1.0</version>
|
||||
<artifactId>it0089-root</artifactId>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-it0089-plugin</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>maven-plugin</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>checkstyle</groupId>
|
||||
<artifactId>checkstyle</artifactId>
|
||||
<version>4.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,71 @@
|
|||
package org.apache.maven.plugins.it0089;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.PackageNamesLoader;
|
||||
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
|
||||
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.MojoFailureException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
|
||||
/**
|
||||
* @goal test
|
||||
*/
|
||||
public class Mojo
|
||||
extends AbstractMojo
|
||||
{
|
||||
|
||||
/**
|
||||
* @parameter default-value="${basedir}/target"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private File outDir;
|
||||
|
||||
public void execute() throws MojoExecutionException, MojoFailureException
|
||||
{
|
||||
try
|
||||
{
|
||||
PackageNamesLoader.loadModuleFactory(Thread.currentThread().getContextClassLoader());
|
||||
getLog().info( "Loaded checkstyle module factory.");
|
||||
|
||||
outDir.mkdirs();
|
||||
|
||||
File output = new File( outDir, "output.txt" );
|
||||
Writer writer = null;
|
||||
|
||||
try
|
||||
{
|
||||
writer = new FileWriter( output );
|
||||
writer.write( "Success." );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new MojoExecutionException( "Failed to write output file.", e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
if ( writer != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
writer.close();
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ( CheckstyleException e )
|
||||
{
|
||||
throw new MojoExecutionException( "Error loading checkstyle module factory.", e );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven.it</groupId>
|
||||
<artifactId>it0089-root</artifactId>
|
||||
<version>1.0</version>
|
||||
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>plugin</module>
|
||||
<module>project</module>
|
||||
</modules>
|
||||
</project>
|
|
@ -0,0 +1 @@
|
|||
rm ${artifact:org.apache.maven.plugins:maven-core-it-plugin:1.0-SNAPSHOT:maven-plugin}
|
|
@ -0,0 +1,30 @@
|
|||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.apache.maven.it</groupId>
|
||||
<version>1.0</version>
|
||||
<artifactId>it0089-root</artifactId>
|
||||
</parent>
|
||||
|
||||
<artifactId>it0089</artifactId>
|
||||
|
||||
<name>Plugin Transitive Dependency Classloading Test</name>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-it0089-plugin</artifactId>
|
||||
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>validate</phase>
|
||||
|
||||
<goals>
|
||||
<goal>test</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
Loading…
Reference in New Issue