From 0d54b2204f9d0fc30ee56534674231612fd5cc8b Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Thu, 20 May 2004 17:06:34 +0000 Subject: [PATCH] turn into a maven plugin and add @tags for descriptor generation. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@162708 13f79535-47bb-0310-9956-ffa450edef68 --- maven-plugins/maven-clean-plugin/project.xml | 13 --- .../org/apache/maven/plugin/CleanPlugin.java | 12 ++- .../main/resources/META-INF/maven/plugin.xml | 21 +++- .../maven-compiler-plugin/project.xml | 36 ------- .../apache/maven/plugin/CompilerPlugin.java | 30 +++--- .../main/resources/META-INF/maven/plugin.xml | 97 +++---------------- maven-plugins/maven-jar-plugin/project.xml | 48 --------- .../org/apache/maven/plugin/JarPlugin.java | 40 ++++++-- .../main/resources/META-INF/maven/plugin.xml | 38 ++++++-- .../maven-resources-plugin/project.xml | 46 +-------- .../apache/maven/plugin/ResourcesPlugin.java | 46 ++++++--- .../main/resources/META-INF/maven/plugin.xml | 26 ++++- .../maven-surefire-plugin/project.xml | 38 +------- .../org/apache/maven/test/SurefirePlugin.java | 27 +++++- .../main/resources/META-INF/maven/plugin.xml | 52 ++++++++-- 15 files changed, 245 insertions(+), 325 deletions(-) diff --git a/maven-plugins/maven-clean-plugin/project.xml b/maven-plugins/maven-clean-plugin/project.xml index a32f0f94b2..c0861eaf83 100644 --- a/maven-plugins/maven-clean-plugin/project.xml +++ b/maven-plugins/maven-clean-plugin/project.xml @@ -12,17 +12,4 @@ 1.0-SNAPSHOT 2001 org.apache.maven - /images/maven.gif - - scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-components/maven-plugins/maven-clean-plugin - scm:cvs:ext:${maven.username}@cvs.apache.org:/home/cvs:maven-components/maven-plugins/maven-clean-plugin - http://cvs.apache.org/viewcvs.cgi/maven/ - - - - maven - maven-core - 2.0-SNAPSHOT - - 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 b389eb15ba..44d8d37171 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,14 +19,16 @@ package org.apache.maven.plugin; import java.io.File; /** - * @plugin.id clean - * @plugin.description A maven2 plugin which cleans the build - * @plugin.instantiation singleton - * @plugin.mode integrated + * @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.outputDirectory #maven.build.dir + * @goal.clean.parameter outputDirectory #maven.build.dir * * @author Emmanuel Venisse * @version $Id$ diff --git a/maven-plugins/maven-clean-plugin/src/main/resources/META-INF/maven/plugin.xml b/maven-plugins/maven-clean-plugin/src/main/resources/META-INF/maven/plugin.xml index 2e18d4d843..de17f6908f 100644 --- a/maven-plugins/maven-clean-plugin/src/main/resources/META-INF/maven/plugin.xml +++ b/maven-plugins/maven-clean-plugin/src/main/resources/META-INF/maven/plugin.xml @@ -1,11 +1,28 @@ clean org.apache.maven.plugin.CleanPlugin - singleton + singleton integrated + + + failedOnError + String + false + validator + description + + + outputDirectory + String + false + validator + description + + clean + Goal which cleans the build failedOnError @@ -18,4 +35,4 @@ - + \ No newline at end of file diff --git a/maven-plugins/maven-compiler-plugin/project.xml b/maven-plugins/maven-compiler-plugin/project.xml index b415a5c546..c135f7f7fb 100644 --- a/maven-plugins/maven-compiler-plugin/project.xml +++ b/maven-plugins/maven-compiler-plugin/project.xml @@ -12,47 +12,11 @@ 1.0-SNAPSHOT 2001 org.apache.maven - /images/maven.gif - - scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-components/maven-plugins/maven-compiler-plugin - scm:cvs:ext:${maven.username}@cvs.apache.org:/home/cvs:maven-components/maven-plugins/maven-compiler-plugin - http://cvs.apache.org/viewcvs.cgi/maven/ - - - xpp3 - xpp3 - 1.1.3.3 - - - plexus - plexus - 0.14-SNAPSHOT - - - plexus - plexus-i18n - 1.0-beta-2-SNAPSHOT - - - classworlds - classworlds - 1.1-SNAPSHOT - - - xstream - xstream - 1.0-SNAPSHOT - plexus plexus-compiler 1.0-SNAPSHOT - - maven - maven-core - 2.0-SNAPSHOT - 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 index 5033b90889..d81b7242cc 100644 --- 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 @@ -2,27 +2,33 @@ 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; -import java.util.Map; /** - * @plugin.id compiler - * @plugin.description A maven2 plugin which integrates the use of Maven2 with IntelliJ's IDEA + * @maven.plugin.id compiler + * @maven.plugin.description A maven2 plugin compiles project sources. * - * @parameter - * - * This may be on a per method basis - * @parameter sourceDirectories String[] required validator + * @parameter sourceDirectory String required validator * @parameter outputDirectory String required validator * @parameter classpathElements String[] required validator * @parameter compiler String required validator * - * The goal would map to a method if multiple methods were allowed - * @goal.name idea - * @goal.idea.parameter project #project + * @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 @@ -40,7 +46,7 @@ import java.util.Map; public class CompilerPlugin extends AbstractPlugin { - private Map compilers; + private Compiler compiler = new JavacCompiler(); private boolean debug = false; @@ -68,8 +74,6 @@ public class CompilerPlugin return; } - Compiler compiler = (Compiler) compilers.get( compilerId ); - List messages = compiler.compile( classpathElements, new String[]{sourceDirectory}, outputDirectory ); if ( debug ) diff --git a/maven-plugins/maven-compiler-plugin/src/main/resources/META-INF/maven/plugin.xml b/maven-plugins/maven-compiler-plugin/src/main/resources/META-INF/maven/plugin.xml index 9b59020663..41448346bf 100644 --- a/maven-plugins/maven-compiler-plugin/src/main/resources/META-INF/maven/plugin.xml +++ b/maven-plugins/maven-compiler-plugin/src/main/resources/META-INF/maven/plugin.xml @@ -1,51 +1,42 @@ compiler org.apache.maven.plugin.CompilerPlugin - singleton + singleton integrated - - - org.codehaus.plexus.compiler.Compiler - compilers - - - - - compile + Compiles application sources sourceDirectory @@ -59,17 +50,11 @@ classpathElements #project.classpathElements - - compiler - javac - test:compile - - compile - + Compiles test sources sourceDirectory @@ -83,60 +68,10 @@ classpathElements #project.classpathElements - - compiler - javac - - - - - - - - compile - - - sourceDirectory - #project.build.sourceDirectory - - - outputDirectory - #maven.build.dest - - - classpathElements - #project.classpathElements - - - compiler - javac - - - - - test:compile compile - - - sourceDirectory - #project.build.unitTestSourceDirectory - - - outputDirectory - #maven.test.dest - - - classpathElements - #project.classpathElements - - - compiler - javac - - - + \ No newline at end of file diff --git a/maven-plugins/maven-jar-plugin/project.xml b/maven-plugins/maven-jar-plugin/project.xml index b40574278e..74cea65d6e 100644 --- a/maven-plugins/maven-jar-plugin/project.xml +++ b/maven-plugins/maven-jar-plugin/project.xml @@ -10,53 +10,5 @@ maven-jar-plugin Maven 1.0-SNAPSHOT - 2001 org.apache.maven - - scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-components/maven-plugins/maven-jar-plugin - scm:cvs:ext:${maven.username}@cvs.apache.org:/home/cvs:maven-components/maven-plugins/maven-jar-plugin - http://cvs.apache.org/viewcvs.cgi/maven/ - - - - maven - maven-core - 2.0-SNAPSHOT - - - maven - maven-model - 2.0-SNAPSHOT - - - maven - maven-project - 2.0-SNAPSHOT - - - xpp3 - xpp3 - 1.1.3.3 - - - plexus - plexus - 0.14-SNAPSHOT - - - classworlds - classworlds - 1.1-SNAPSHOT - - - xstream - xstream - 1.0-SNAPSHOT - - - plexus - plexus-compiler - 1.0-SNAPSHOT - - diff --git a/maven-plugins/maven-jar-plugin/src/main/java/org/apache/maven/plugin/JarPlugin.java b/maven-plugins/maven-jar-plugin/src/main/java/org/apache/maven/plugin/JarPlugin.java index f2b949a93b..2c4fc78e8a 100644 --- a/maven-plugins/maven-jar-plugin/src/main/java/org/apache/maven/plugin/JarPlugin.java +++ b/maven-plugins/maven-jar-plugin/src/main/java/org/apache/maven/plugin/JarPlugin.java @@ -68,6 +68,20 @@ import java.util.jar.JarOutputStream; import java.util.jar.Manifest; /** + * @maven.plugin.id jar + * @maven.plugin.description Maven plugin to build jars + * + * @parameter jarName String true validator description + * @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 * * @author Michal Maczka * @version $Id$ @@ -80,17 +94,27 @@ import java.util.jar.Manifest; * maven.remote.group */ public class JarPlugin + extends AbstractPlugin { - private String jarName; - - private String outputDirectory; - - private String basedir; - - public void execute() + public void execute( PluginExecutionRequest request, PluginExecutionResponse response ) throws Exception { - File basedir = new File( this.basedir ); + // ---------------------------------------------------------------------- + // + // ---------------------------------------------------------------------- + + System.out.println( request.getParameter( "basedir" ) ); + + File basedir = new File( (String) request.getParameter( "basedir" ) ); + + String outputDirectory = (String) request.getParameter( "outputDirectory" ); + + String jarName = (String) request.getParameter( "jarName" ); + + // ---------------------------------------------------------------------- + // + // ---------------------------------------------------------------------- + File jarFile = new File( new File( outputDirectory ), jarName + ".jar" ); diff --git a/maven-plugins/maven-jar-plugin/src/main/resources/META-INF/maven/plugin.xml b/maven-plugins/maven-jar-plugin/src/main/resources/META-INF/maven/plugin.xml index 1b5a97d89c..74babf0729 100644 --- a/maven-plugins/maven-jar-plugin/src/main/resources/META-INF/maven/plugin.xml +++ b/maven-plugins/maven-jar-plugin/src/main/resources/META-INF/maven/plugin.xml @@ -1,15 +1,35 @@ jar org.apache.maven.plugin.JarPlugin - per-lookup - field + singleton + integrated + + + jarName + String + false + validator + description + + + outputDirectory + String + false + validator + description + + + basedir + String + false + validator + description + + jar - - test - resources - + build a jar jarName @@ -24,6 +44,10 @@ #maven.build.dest + + test + resources + - + \ No newline at end of file diff --git a/maven-plugins/maven-resources-plugin/project.xml b/maven-plugins/maven-resources-plugin/project.xml index 884e6a7f9a..ac137e5a46 100644 --- a/maven-plugins/maven-resources-plugin/project.xml +++ b/maven-plugins/maven-resources-plugin/project.xml @@ -9,14 +9,8 @@ maven maven-resources-plugin Maven - 1.0-SNAPSHOT - 2001 + 1.0-SNAPSHOT org.apache.maven - - scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-components/maven-plugins/maven-resources-plugin - scm:cvs:ext:${maven.username}@cvs.apache.org:/home/cvs:maven-components/maven-plugins/maven-resources-plugin - http://cvs.apache.org/viewcvs.cgi/maven/ - maven @@ -33,43 +27,5 @@ maven-project 2.0-SNAPSHOT - - commons-cli - commons-cli - 1.0-beta-2 - - - - - - xpp3 - xpp3 - 1.1.3.3 - - - plexus - plexus - 0.14-SNAPSHOT - - - plexus - plexus-i18n - 1.0-beta-2-SNAPSHOT - - - classworlds - classworlds - 1.1-SNAPSHOT - - - xstream - xstream - 1.0-SNAPSHOT - - - plexus - plexus-compiler - 1.0-SNAPSHOT - 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/ResourcesPlugin.java index d543d78849..296d5fc148 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/ResourcesPlugin.java @@ -68,30 +68,46 @@ 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.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 * * @author Michal Maczka + * @author Jason van Zyl + * * @version $Id$ * - * maven.jar.manifest.extensions.add - * maven.jar.includes - * maven.jar.excludes - * maven.jar.index - * maven.jar.compress - * maven.remote.group - * - * @todo separate this into a resources plugin and jar plugin so that the resource - * copying can be used as part of testing, right now the resources are being copied - * directly into the JAR, need to make them available to testing. */ public class ResourcesPlugin + extends AbstractPlugin { - private String outputDirectory; - - private List resources; - - public void execute() + public void execute( PluginExecutionRequest request, PluginExecutionResponse response ) throws Exception { + // ---------------------------------------------------------------------- + // + // ---------------------------------------------------------------------- + + String outputDirectory = (String) request.getParameter( "outputDirectory" ); + + List resources = (List) request.getParameter( "resources" ); + + // ---------------------------------------------------------------------- + // + // ---------------------------------------------------------------------- + for ( Iterator i = getJarResources( resources ).iterator(); i.hasNext(); ) { ResourceEntry resourceEntry = (ResourceEntry) i.next(); diff --git a/maven-plugins/maven-resources-plugin/src/main/resources/META-INF/maven/plugin.xml b/maven-plugins/maven-resources-plugin/src/main/resources/META-INF/maven/plugin.xml index 5dd630744a..1c7bdc89e1 100644 --- a/maven-plugins/maven-resources-plugin/src/main/resources/META-INF/maven/plugin.xml +++ b/maven-plugins/maven-resources-plugin/src/main/resources/META-INF/maven/plugin.xml @@ -1,11 +1,28 @@ - resource-copier + resources org.apache.maven.plugin.ResourcesPlugin - per-lookup - field + singleton + integrated + + + outputDirectory + String + false + validator + description + + + resources + List + false + validator + description + + resources + copy application resources outputDirectory @@ -19,6 +36,7 @@ test:resources + copy test resources outputDirectory @@ -31,4 +49,4 @@ - + \ No newline at end of file diff --git a/maven-plugins/maven-surefire-plugin/project.xml b/maven-plugins/maven-surefire-plugin/project.xml index 6986c88223..6abfae5677 100644 --- a/maven-plugins/maven-surefire-plugin/project.xml +++ b/maven-plugins/maven-surefire-plugin/project.xml @@ -9,49 +9,13 @@ maven maven-surefire-plugin Maven - 1.0-SNAPSHOT - 2001 + 1.0-SNAPSHOT org.apache.maven - - scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-components/maven-plugins/maven-surefire-plugin - scm:cvs:ext:${maven.username}@cvs.apache.org:/home/cvs:maven-components/maven-plugins/maven-surefire-plugin - http://cvs.apache.org/viewcvs.cgi/maven/ - surefire surefire-booter 1.0 - - maven - maven-core - 2.0-SNAPSHOT - - - xpp3 - xpp3 - 1.1.3.3 - - - plexus - plexus - 0.14-SNAPSHOT - - - plexus - plexus-i18n - 1.0-beta-2-SNAPSHOT - - - classworlds - classworlds - 1.1-SNAPSHOT - - - xstream - xstream - 1.0-SNAPSHOT - 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 d0fa7e17e5..8229980085 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 @@ -9,20 +9,39 @@ import java.io.File; import java.util.List; /** + * @maven.plugin.id surefire + * @maven.plugin.description A maven2 plugin which uses surefire as a test runner + * + * @parameter mavenRepoLocal String required validator + * @parameter basedir String required validator + * @parameter includes String required validator + * @parameter excludes String required validator + * @parameter classpathElements String[] required validator + * + * @goal.name test + * @goal.test.description Run tests using surefire + * + * @goal.test.prereq test:compile + * @goal.test.prereq resources + * @goal.test.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 + * @author Jason van Zyl * @version $Id$ + * * @todo make version of junit and surefire configurable * @todo make report to be produced configurable */ public class SurefirePlugin extends AbstractPlugin { - public void execute( PluginExecutionRequest request, PluginExecutionResponse response ) throws Exception - - //public void execute( String mavenRepoLocal, String basedir, List includes, List excludes, String[] classpathElements ) - // throws Exception { // ---------------------------------------------------------------------- // diff --git a/maven-plugins/maven-surefire-plugin/src/main/resources/META-INF/maven/plugin.xml b/maven-plugins/maven-surefire-plugin/src/main/resources/META-INF/maven/plugin.xml index 88e16c970e..90da75004b 100644 --- a/maven-plugins/maven-surefire-plugin/src/main/resources/META-INF/maven/plugin.xml +++ b/maven-plugins/maven-surefire-plugin/src/main/resources/META-INF/maven/plugin.xml @@ -1,16 +1,49 @@ surefire org.apache.maven.test.SurefirePlugin - singleton + singleton integrated + + + mavenRepoLocal + String + false + validator + + + + basedir + String + false + validator + + + + includes + String + false + validator + + + + excludes + String + false + validator + + + + classpathElements + String[] + false + validator + + + test - - test:compile - resources - test:resources - + Run tests using surefire mavenRepoLocal @@ -33,6 +66,11 @@ #project.classpathElements + + test:compile + resources + test:resources + - + \ No newline at end of file