From fcb3ef28bffab16243a70dfe46ddfc4f62abad19 Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Thu, 19 Oct 2006 20:49:44 +0000 Subject: [PATCH] o adding IT it0089 git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@465863 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/test/resources/it0089/plugin/pom.xml | 26 +++++++ .../org/apache/maven/plugins/it0089/Mojo.java | 71 +++++++++++++++++++ .../src/test/resources/it0089/pom.xml | 16 +++++ .../src/test/resources/it0089/project/pom.xml | 30 ++++++++ 4 files changed, 143 insertions(+) create mode 100644 maven-core-integration-tests/src/test/resources/it0089/plugin/pom.xml create mode 100644 maven-core-integration-tests/src/test/resources/it0089/plugin/src/main/java/org/apache/maven/plugins/it0089/Mojo.java create mode 100644 maven-core-integration-tests/src/test/resources/it0089/pom.xml create mode 100644 maven-core-integration-tests/src/test/resources/it0089/project/pom.xml diff --git a/maven-core-integration-tests/src/test/resources/it0089/plugin/pom.xml b/maven-core-integration-tests/src/test/resources/it0089/plugin/pom.xml new file mode 100644 index 0000000000..271c608284 --- /dev/null +++ b/maven-core-integration-tests/src/test/resources/it0089/plugin/pom.xml @@ -0,0 +1,26 @@ + + 4.0.0 + + org.apache.maven.it + 1.0 + it0089-root + + + org.apache.maven.plugins + maven-it0089-plugin + 1.0-SNAPSHOT + maven-plugin + + + + checkstyle + checkstyle + 4.1 + + + org.apache.maven + maven-plugin-api + 2.0 + + + diff --git a/maven-core-integration-tests/src/test/resources/it0089/plugin/src/main/java/org/apache/maven/plugins/it0089/Mojo.java b/maven-core-integration-tests/src/test/resources/it0089/plugin/src/main/java/org/apache/maven/plugins/it0089/Mojo.java new file mode 100644 index 0000000000..27617fbc7c --- /dev/null +++ b/maven-core-integration-tests/src/test/resources/it0089/plugin/src/main/java/org/apache/maven/plugins/it0089/Mojo.java @@ -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 ); + } + } + +} diff --git a/maven-core-integration-tests/src/test/resources/it0089/pom.xml b/maven-core-integration-tests/src/test/resources/it0089/pom.xml new file mode 100644 index 0000000000..755fc114fa --- /dev/null +++ b/maven-core-integration-tests/src/test/resources/it0089/pom.xml @@ -0,0 +1,16 @@ + + 4.0.0 + org.apache.maven.it + it0089-root + Test that Checkstyle PackageNamesLoader.loadModuleFactory(..) method will complete as-is with + the context classloader available to the plugin. + + 1.0 + + pom + + + plugin + project + + diff --git a/maven-core-integration-tests/src/test/resources/it0089/project/pom.xml b/maven-core-integration-tests/src/test/resources/it0089/project/pom.xml new file mode 100644 index 0000000000..8489730af7 --- /dev/null +++ b/maven-core-integration-tests/src/test/resources/it0089/project/pom.xml @@ -0,0 +1,30 @@ + + 4.0.0 + + org.apache.maven.it + 1.0 + it0089-root + + + it0089 + + Plugin Transitive Dependency Classloading Test + + + + + maven-it0089-plugin + + + + validate + + + test + + + + + + +