mirror of https://github.com/apache/maven.git
o adding IT it0089
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@465863 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
af51d54d16
commit
fcb3ef28bf
|
@ -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,16 @@
|
|||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven.it</groupId>
|
||||
<artifactId>it0089-root</artifactId>
|
||||
<description>Test that Checkstyle PackageNamesLoader.loadModuleFactory(..) method will complete as-is with
|
||||
the context classloader available to the plugin.
|
||||
</description>
|
||||
<version>1.0</version>
|
||||
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>plugin</module>
|
||||
<module>project</module>
|
||||
</modules>
|
||||
</project>
|
|
@ -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