From 072609e0b3788efd42acaf3394f7a41ed8326cfa Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Fri, 11 Jun 2004 16:14:40 +0000 Subject: [PATCH] o cleaning up the @tags which are now a lot more simple git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@162742 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/maven/plugin/CleanPlugin.java | 15 ++- .../apache/maven/plugin/CompilerPlugin.java | 117 ------------------ .../maven/plugin/jar/JarInstallMojo.java | 22 ++-- .../org/apache/maven/plugin/jar/JarMojo.java | 14 +-- .../plugin/plugin/DescriptorGenerator.java | 10 +- ...esourcesPlugin.java => ResourcesMojo.java} | 15 +-- .../maven/plugin/TestResourcesMojo.java | 91 ++++++++++++++ .../org/apache/maven/test/SurefirePlugin.java | 20 +-- 8 files changed, 138 insertions(+), 166 deletions(-) delete mode 100644 maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/CompilerPlugin.java rename maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/{ResourcesPlugin.java => ResourcesMojo.java} (94%) create mode 100644 maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/TestResourcesMojo.java diff --git a/maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/plugin/CleanPlugin.java b/maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/plugin/CleanPlugin.java index b6b74f766c..d56d72559c 100644 --- a/maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/plugin/CleanPlugin.java +++ b/maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/plugin/CleanPlugin.java @@ -19,16 +19,19 @@ package org.apache.maven.plugin; import java.io.File; /** - * @author Emmanuel Venisse - * @version $Id$ * @maven.plugin.id clean * @maven.plugin.description A maven2 plugin which cleans the build + * * @parameter failedOnError String true validator description * @parameter outputDirectory String true validator description - * @goal.name clean - * @goal.clean.description Goal which cleans the build - * @goal.clean.parameter failedOnError false - * @goal.clean.parameter outputDirectory #maven.build.dir + * + * @goal clean + * @goal.description Goal which cleans the build + * @goal.parameter failedOnError false + * @goal.parameter outputDirectory #project.build.directory + * + * @author Emmanuel Venisse + * @version $Id$ */ public class CleanPlugin extends AbstractPlugin diff --git a/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/CompilerPlugin.java b/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/CompilerPlugin.java deleted file mode 100644 index d81b7242cc..0000000000 --- a/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/CompilerPlugin.java +++ /dev/null @@ -1,117 +0,0 @@ -package org.apache.maven.plugin; - -import org.codehaus.plexus.compiler.Compiler; -import org.codehaus.plexus.compiler.CompilerError; -import org.codehaus.plexus.compiler.javac.JavacCompiler; - -import java.io.File; -import java.util.Iterator; -import java.util.List; - -/** - * @maven.plugin.id compiler - * @maven.plugin.description A maven2 plugin compiles project sources. - * - * @parameter sourceDirectory String required validator - * @parameter outputDirectory String required validator - * @parameter classpathElements String[] required validator - * @parameter compiler String required validator - * - * @goal.name compile - * @goal.compile.description Compiles application sources - * @goal.compile.parameter sourceDirectory #project.build.sourceDirectory - * @goal.compile.parameter outputDirectory #maven.build.dest - * @goal.compile.parameter classpathElements #project.classpathElements - * - * @goal.name test:compile - * @goal.test:compile.prereq compile - * @goal.test:compile.description Compiles test sources - * @goal.test:compile.parameter sourceDirectory #project.build.unitTestSourceDirectory - * @goal.test:compile.parameter outputDirectory #maven.test.dest - * @goal.test:compile.parameter classpathElements #project.classpathElements - * - * There could be threadsafe and non threadsafe versions of a compiler - * plugin. The case where you instantiate a compiler plugin that maintains - * a reference to an incremental compiler. - * - * @author Jason van Zyl - * @version $Id$ - * @todo make a plugin for each plugin type so that they are not all globbed in here - * this will remove the magic plexus does with Map requirements which will make - * reuse outside of the maven/plexus context easier - * @todo use compile source roots and not the pom.build.sourceDirectory so that any - * sort of preprocessing and/or source generation can be taken into consideration. - */ - -public class CompilerPlugin - extends AbstractPlugin -{ - private Compiler compiler = new JavacCompiler(); - - private boolean debug = false; - - public void execute( PluginExecutionRequest request, PluginExecutionResponse response ) - throws Exception - { - // ---------------------------------------------------------------------- - // - // ---------------------------------------------------------------------- - - String sourceDirectory = (String) request.getParameter( "sourceDirectory" ); - - String outputDirectory = (String) request.getParameter( "outputDirectory" ); - - String[] classpathElements = (String[]) request.getParameter( "classpathElements" ); - - String compilerId = (String) request.getParameter( "compiler" ); - - // ---------------------------------------------------------------------- - // - // ---------------------------------------------------------------------- - - if ( ! new File( sourceDirectory ).exists() ) - { - return; - } - - List messages = compiler.compile( classpathElements, new String[]{sourceDirectory}, outputDirectory ); - - if ( debug ) - { - for ( int i = 0; i < classpathElements.length; i++ ) - { - String message; - - if ( new File( classpathElements[i] ).exists() ) - { - message = "present in repository."; - } - else - { - message = "Warning! not present in repository!"; - } - - System.out.println( "classpathElements[ "+ i +" ] = " + classpathElements[i] + ": " + message ); - } - } - - boolean compilationError = false; - - for ( Iterator i = messages.iterator(); i.hasNext(); ) - { - CompilerError message = (CompilerError) i.next(); - - if ( message.isError() ) - { - compilationError = true; - } - - System.out.println( message.getMessage() ); - } - - if ( compilationError ) - { - throw new Exception( "Compilation failure!" ); - } - } -} diff --git a/maven-plugins/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/JarInstallMojo.java b/maven-plugins/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/JarInstallMojo.java index 62f0925db8..f7d9b4f184 100644 --- a/maven-plugins/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/JarInstallMojo.java +++ b/maven-plugins/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/JarInstallMojo.java @@ -39,18 +39,18 @@ import java.io.File; * @parameter localRepository String true validator description * @parameter pomFile java.io.File true validator description * * - * @goal.name jar:install - * @goal.jar:install.description install a jar in local repository + * @goal jar:install + * @goal.description install a jar in local repository * - * @goal.jar:install.prereq jar - * @goal.jar:install.parameter jarName #maven.final.name - * @goal.jar:install.parameter outputDirectory #maven.build.dir - * @goal.jar:install.parameter basedir #maven.build.dest - * @goal.jar:install.parameter pomFile #project.file - * @goal.jar:install.parameter groupId #project.groupId - * @goal.jar:install.parameter artifactId #project.artifactId - * @goal.jar:install.parameter version #project.version - * @goal.jar:install.parameter localRepository #project.localRepository + * @goal.prereq jar + * @goal.parameter jarName #maven.final.name + * @goal.parameter outputDirectory #project.build.directory + * @goal.parameter basedir #project.build.directory/classes + * @goal.parameter pomFile #project.file + * @goal.parameter groupId #project.groupId + * @goal.parameter artifactId #project.artifactId + * @goal.parameter version #project.version + * @goal.parameter localRepository #project.localRepository */ public class JarInstallMojo extends AbstractPlugin diff --git a/maven-plugins/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/JarMojo.java b/maven-plugins/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/JarMojo.java index ed74c86d09..eb557b4e0c 100644 --- a/maven-plugins/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/JarMojo.java +++ b/maven-plugins/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/JarMojo.java @@ -38,13 +38,13 @@ import java.util.jar.Manifest; * @parameter outputDirectory String true validator description * @parameter basedir String true validator description * - * @goal.name jar - * @goal.jar.description build a jar - * @goal.jar.prereq test - * @goal.jar.prereq resources - * @goal.jar.parameter jarName #maven.final.name - * @goal.jar.parameter outputDirectory #maven.build.dir - * @goal.jar.parameter basedir #maven.build.dest + * @goal jar + * @goal.description build a jar + * @goal.prereq test + * @goal.prereq resources + * @goal.parameter jarName #maven.final.name + * @goal.parameter outputDirectory #project.build.directory + * @goal.parameter basedir #project.build.directory/classes * * @author Michal Maczka * @version $Id$ diff --git a/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGenerator.java b/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGenerator.java index 45d1576a1d..7ad2a1a7c5 100644 --- a/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGenerator.java +++ b/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGenerator.java @@ -10,11 +10,11 @@ import org.apache.maven.plugin.generator.PluginDescriptorGenerator; * @parameter outputDirectory String true validator description * @parameter pom String true validator description * - * @goal.name descriptor - * @goal.descriptor.description Goal for generating a plugin descriptor. - * @goal.descriptor.parameter sourceDirectory #project.build.sourceDirectory - * @goal.descriptor.parameter outputDirectory #maven.build.dest/META-INF/maven - * @goal.descriptor.parameter pom #project.getFile().getPath() + * @goal descriptor + * @goal.description Goal for generating a plugin descriptor. + * @goal.parameter sourceDirectory #project.build.sourceDirectory + * @goal.parameter outputDirectory #project.build.directory/classes/META-INF/maven + * @goal.parameter pom #project.getFile().getPath() * @author Jason van Zyl * @version $Id$ diff --git a/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/ResourcesPlugin.java b/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/ResourcesMojo.java similarity index 94% rename from maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/ResourcesPlugin.java rename to maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/ResourcesMojo.java index 296d5fc148..52439d7f63 100644 --- a/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/ResourcesPlugin.java +++ b/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/ResourcesMojo.java @@ -74,15 +74,10 @@ import java.util.List; * @parameter outputDirectory String true validator description * @parameter resources List true validator description * - * @goal.name resources - * @goal.resources.description copy application resources - * @goal.resources.parameter outputDirectory #maven.build.dest - * @goal.resources.parameter resources #project.build.resources - * - * @goal.name test:resources - * @goal.test:resources.description copy test resources - * @goal.test:resources.parameter outputDirectory #maven.test.dest - * @goal.test:resources.parameter resources #project.build.unitTest.resources + * @goal resources + * @goal.description copy application resources + * @goal.parameter outputDirectory #project.build.directory/classes + * @goal.parameter resources #project.build.resources * * @author Michal Maczka * @author Jason van Zyl @@ -90,7 +85,7 @@ import java.util.List; * @version $Id$ * */ -public class ResourcesPlugin +public class ResourcesMojo extends AbstractPlugin { public void execute( PluginExecutionRequest request, PluginExecutionResponse response ) diff --git a/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/TestResourcesMojo.java b/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/TestResourcesMojo.java new file mode 100644 index 0000000000..fa75ec70bb --- /dev/null +++ b/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/TestResourcesMojo.java @@ -0,0 +1,91 @@ +package org.apache.maven.plugin; + +/* ==================================================================== + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2001 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Apache" and "Apache Software Foundation" and + * "Apache Maven" must not be used to endorse or promote products + * derived from this software without prior written permission. For + * written permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * "Apache Maven", nor may "Apache" appear in their name, without + * prior written permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + * + * ==================================================================== + */ + +import org.apache.maven.model.Resource; +import org.codehaus.plexus.util.FileUtils; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +/** + * @maven.plugin.id resources + * @maven.plugin.description Maven plugin to build jars + * + * @parameter outputDirectory String true validator description + * @parameter resources List true validator description + * + * @goal test:resources + * @goal.description copy test resources + * @goal.parameter outputDirectory #project.build.directory/test-classes + * @goal.parameter resources #project.build.unitTest.resources + * + * @author Michal Maczka + * @author Jason van Zyl + * + * @version $Id$ + * + */ +public class TestResourcesMojo + extends ResourcesMojo +{ +} diff --git a/maven-plugins/maven-surefire-plugin/src/main/java/org/apache/maven/test/SurefirePlugin.java b/maven-plugins/maven-surefire-plugin/src/main/java/org/apache/maven/test/SurefirePlugin.java index 8229980085..3ab4fe5bd8 100644 --- a/maven-plugins/maven-surefire-plugin/src/main/java/org/apache/maven/test/SurefirePlugin.java +++ b/maven-plugins/maven-surefire-plugin/src/main/java/org/apache/maven/test/SurefirePlugin.java @@ -18,18 +18,18 @@ import java.util.List; * @parameter excludes String required validator * @parameter classpathElements String[] required validator * - * @goal.name test - * @goal.test.description Run tests using surefire + * @goal test + * @goal.description Run tests using surefire * - * @goal.test.prereq test:compile - * @goal.test.prereq resources - * @goal.test.prereq test:resources + * @goal.prereq test:compile + * @goal.prereq resources + * @goal.prereq test:resources * - * @goal.test.parameter mavenRepoLocal #maven.repo.local - * @goal.test.parameter basedir #basedir - * @goal.test.parameter includes #project.build.unitTest.includes - * @goal.test.parameter excludes #project.build.unitTest.excludes - * @goal.test.parameter classpathElements #project.classpathElements + * @goal.parameter mavenRepoLocal #maven.repo.local + * @goal.parameter basedir #basedir + * @goal.parameter includes #project.build.unitTest.includes + * @goal.parameter excludes #project.build.unitTest.excludes + * @goal.parameter classpathElements #project.classpathElements * @author Jason van Zyl * @version $Id$