mirror of https://github.com/apache/maven.git
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
This commit is contained in:
parent
0a5f04c0a6
commit
0d54b2204f
|
@ -12,17 +12,4 @@
|
||||||
<currentVersion>1.0-SNAPSHOT</currentVersion>
|
<currentVersion>1.0-SNAPSHOT</currentVersion>
|
||||||
<inceptionYear>2001</inceptionYear>
|
<inceptionYear>2001</inceptionYear>
|
||||||
<package>org.apache.maven</package>
|
<package>org.apache.maven</package>
|
||||||
<logo>/images/maven.gif</logo>
|
|
||||||
<repository>
|
|
||||||
<connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-components/maven-plugins/maven-clean-plugin</connection>
|
|
||||||
<developerConnection>scm:cvs:ext:${maven.username}@cvs.apache.org:/home/cvs:maven-components/maven-plugins/maven-clean-plugin</developerConnection>
|
|
||||||
<url>http://cvs.apache.org/viewcvs.cgi/maven/</url>
|
|
||||||
</repository>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>maven</groupId>
|
|
||||||
<artifactId>maven-core</artifactId>
|
|
||||||
<version>2.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -19,14 +19,16 @@ package org.apache.maven.plugin;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @plugin.id clean
|
* @maven.plugin.id clean
|
||||||
* @plugin.description A maven2 plugin which cleans the build
|
* @maven.plugin.description A maven2 plugin which cleans the build
|
||||||
* @plugin.instantiation singleton
|
*
|
||||||
* @plugin.mode integrated
|
* @parameter failedOnError String true validator description
|
||||||
|
* @parameter outputDirectory String true validator description
|
||||||
*
|
*
|
||||||
* @goal.name clean
|
* @goal.name clean
|
||||||
|
* @goal.clean.description Goal which cleans the build
|
||||||
* @goal.clean.parameter failedOnError false
|
* @goal.clean.parameter failedOnError false
|
||||||
* @goal.clean.outputDirectory #maven.build.dir
|
* @goal.clean.parameter outputDirectory #maven.build.dir
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:evenisse@maven.org">Emmanuel Venisse</a>
|
* @author <a href="mailto:evenisse@maven.org">Emmanuel Venisse</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
|
|
@ -1,11 +1,28 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<id>clean</id>
|
<id>clean</id>
|
||||||
<implementation>org.apache.maven.plugin.CleanPlugin</implementation>
|
<implementation>org.apache.maven.plugin.CleanPlugin</implementation>
|
||||||
<instantiation-strategy>singleton</instantiation-strategy>
|
<instantiationStrategy>singleton</instantiationStrategy>
|
||||||
<mode>integrated</mode>
|
<mode>integrated</mode>
|
||||||
|
<parameters>
|
||||||
|
<parameter>
|
||||||
|
<name>failedOnError</name>
|
||||||
|
<type>String</type>
|
||||||
|
<required>false</required>
|
||||||
|
<validator>validator</validator>
|
||||||
|
<description>description </description>
|
||||||
|
</parameter>
|
||||||
|
<parameter>
|
||||||
|
<name>outputDirectory</name>
|
||||||
|
<type>String</type>
|
||||||
|
<required>false</required>
|
||||||
|
<validator>validator</validator>
|
||||||
|
<description>description </description>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>
|
<goal>
|
||||||
<name>clean</name>
|
<name>clean</name>
|
||||||
|
<description>Goal which cleans the build</description>
|
||||||
<parameters>
|
<parameters>
|
||||||
<parameter>
|
<parameter>
|
||||||
<name>failedOnError</name>
|
<name>failedOnError</name>
|
||||||
|
@ -18,4 +35,4 @@
|
||||||
</parameters>
|
</parameters>
|
||||||
</goal>
|
</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</plugin>
|
</plugin>
|
|
@ -12,47 +12,11 @@
|
||||||
<currentVersion>1.0-SNAPSHOT</currentVersion>
|
<currentVersion>1.0-SNAPSHOT</currentVersion>
|
||||||
<inceptionYear>2001</inceptionYear>
|
<inceptionYear>2001</inceptionYear>
|
||||||
<package>org.apache.maven</package>
|
<package>org.apache.maven</package>
|
||||||
<logo>/images/maven.gif</logo>
|
|
||||||
<repository>
|
|
||||||
<connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-components/maven-plugins/maven-compiler-plugin</connection>
|
|
||||||
<developerConnection>scm:cvs:ext:${maven.username}@cvs.apache.org:/home/cvs:maven-components/maven-plugins/maven-compiler-plugin</developerConnection>
|
|
||||||
<url>http://cvs.apache.org/viewcvs.cgi/maven/</url>
|
|
||||||
</repository>
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>xpp3</groupId>
|
|
||||||
<artifactId>xpp3</artifactId>
|
|
||||||
<version>1.1.3.3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>plexus</groupId>
|
|
||||||
<artifactId>plexus</artifactId>
|
|
||||||
<version>0.14-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>plexus</groupId>
|
|
||||||
<artifactId>plexus-i18n</artifactId>
|
|
||||||
<version>1.0-beta-2-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>classworlds</groupId>
|
|
||||||
<artifactId>classworlds</artifactId>
|
|
||||||
<version>1.1-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>xstream</groupId>
|
|
||||||
<artifactId>xstream</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>plexus</groupId>
|
<groupId>plexus</groupId>
|
||||||
<artifactId>plexus-compiler</artifactId>
|
<artifactId>plexus-compiler</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>maven</groupId>
|
|
||||||
<artifactId>maven-core</artifactId>
|
|
||||||
<version>2.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -2,27 +2,33 @@ package org.apache.maven.plugin;
|
||||||
|
|
||||||
import org.codehaus.plexus.compiler.Compiler;
|
import org.codehaus.plexus.compiler.Compiler;
|
||||||
import org.codehaus.plexus.compiler.CompilerError;
|
import org.codehaus.plexus.compiler.CompilerError;
|
||||||
|
import org.codehaus.plexus.compiler.javac.JavacCompiler;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @plugin.id compiler
|
* @maven.plugin.id compiler
|
||||||
* @plugin.description A maven2 plugin which integrates the use of Maven2 with IntelliJ's IDEA
|
* @maven.plugin.description A maven2 plugin compiles project sources.
|
||||||
*
|
*
|
||||||
* @parameter <name> <type> <required> <validatator> <description>
|
* @parameter sourceDirectory String required validator
|
||||||
*
|
|
||||||
* This may be on a per method basis
|
|
||||||
* @parameter sourceDirectories String[] required validator
|
|
||||||
* @parameter outputDirectory String required validator
|
* @parameter outputDirectory String required validator
|
||||||
* @parameter classpathElements String[] required validator
|
* @parameter classpathElements String[] required validator
|
||||||
* @parameter compiler String required validator
|
* @parameter compiler String required validator
|
||||||
*
|
*
|
||||||
* The goal would map to a method if multiple methods were allowed
|
* @goal.name compile
|
||||||
* @goal.name idea
|
* @goal.compile.description Compiles application sources
|
||||||
* @goal.idea.parameter project #project
|
* @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
|
* There could be threadsafe and non threadsafe versions of a compiler
|
||||||
* plugin. The case where you instantiate a compiler plugin that maintains
|
* plugin. The case where you instantiate a compiler plugin that maintains
|
||||||
|
@ -40,7 +46,7 @@ import java.util.Map;
|
||||||
public class CompilerPlugin
|
public class CompilerPlugin
|
||||||
extends AbstractPlugin
|
extends AbstractPlugin
|
||||||
{
|
{
|
||||||
private Map compilers;
|
private Compiler compiler = new JavacCompiler();
|
||||||
|
|
||||||
private boolean debug = false;
|
private boolean debug = false;
|
||||||
|
|
||||||
|
@ -68,8 +74,6 @@ public class CompilerPlugin
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Compiler compiler = (Compiler) compilers.get( compilerId );
|
|
||||||
|
|
||||||
List messages = compiler.compile( classpathElements, new String[]{sourceDirectory}, outputDirectory );
|
List messages = compiler.compile( classpathElements, new String[]{sourceDirectory}, outputDirectory );
|
||||||
|
|
||||||
if ( debug )
|
if ( debug )
|
||||||
|
|
|
@ -1,51 +1,42 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<id>compiler</id>
|
<id>compiler</id>
|
||||||
<implementation>org.apache.maven.plugin.CompilerPlugin</implementation>
|
<implementation>org.apache.maven.plugin.CompilerPlugin</implementation>
|
||||||
<instantiation-strategy>singleton</instantiation-strategy>
|
<instantiationStrategy>singleton</instantiationStrategy>
|
||||||
<mode>integrated</mode>
|
<mode>integrated</mode>
|
||||||
<requirements>
|
|
||||||
<requirement>
|
|
||||||
<role>org.codehaus.plexus.compiler.Compiler</role>
|
|
||||||
<field-name>compilers</field-name>
|
|
||||||
</requirement>
|
|
||||||
</requirements>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
<parameters>
|
<parameters>
|
||||||
<parameter>
|
<parameter>
|
||||||
<name>sourceDirectory</name>
|
<name>sourceDirectory</name>
|
||||||
|
<type>String</type>
|
||||||
|
<required>false</required>
|
||||||
|
<validator>validator</validator>
|
||||||
<description></description>
|
<description></description>
|
||||||
</parameter>
|
</parameter>
|
||||||
<parameter>
|
<parameter>
|
||||||
<name>outputDirectory</name>
|
<name>outputDirectory</name>
|
||||||
|
<type>String</type>
|
||||||
|
<required>false</required>
|
||||||
|
<validator>validator</validator>
|
||||||
<description></description>
|
<description></description>
|
||||||
</parameter>
|
</parameter>
|
||||||
<parameter>
|
<parameter>
|
||||||
<name>classpathElements</name>
|
<name>classpathElements</name>
|
||||||
|
<type>String[]</type>
|
||||||
|
<required>false</required>
|
||||||
|
<validator>validator</validator>
|
||||||
<description></description>
|
<description></description>
|
||||||
</parameter>
|
</parameter>
|
||||||
<parameter>
|
<parameter>
|
||||||
<name>compiler</name>
|
<name>compiler</name>
|
||||||
|
<type>String</type>
|
||||||
|
<required>false</required>
|
||||||
|
<validator>validator</validator>
|
||||||
<description></description>
|
<description></description>
|
||||||
</parameter>
|
</parameter>
|
||||||
</parameters>
|
</parameters>
|
||||||
|
|
||||||
<goals>
|
|
||||||
<goal>
|
|
||||||
<name>compile</name>
|
|
||||||
<expressions>
|
|
||||||
<expression>#project.build.sourceDirectory</expression>
|
|
||||||
<expression>#maven.build.dest</expression>
|
|
||||||
<expression>#project.classpathElements</expression>
|
|
||||||
<expression>javac</expression>
|
|
||||||
</expressions>
|
|
||||||
</goal>
|
|
||||||
</goals>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<goals>
|
<goals>
|
||||||
<goal>
|
<goal>
|
||||||
<name>compile</name>
|
<name>compile</name>
|
||||||
|
<description>Compiles application sources</description>
|
||||||
<parameters>
|
<parameters>
|
||||||
<parameter>
|
<parameter>
|
||||||
<name>sourceDirectory</name>
|
<name>sourceDirectory</name>
|
||||||
|
@ -59,17 +50,11 @@
|
||||||
<name>classpathElements</name>
|
<name>classpathElements</name>
|
||||||
<expression>#project.classpathElements</expression>
|
<expression>#project.classpathElements</expression>
|
||||||
</parameter>
|
</parameter>
|
||||||
<parameter>
|
|
||||||
<name>compiler</name>
|
|
||||||
<expression>javac</expression>
|
|
||||||
</parameter>
|
|
||||||
</parameters>
|
</parameters>
|
||||||
</goal>
|
</goal>
|
||||||
<goal>
|
<goal>
|
||||||
<name>test:compile</name>
|
<name>test:compile</name>
|
||||||
<prereqs>
|
<description>Compiles test sources</description>
|
||||||
<prereq>compile</prereq>
|
|
||||||
</prereqs>
|
|
||||||
<parameters>
|
<parameters>
|
||||||
<parameter>
|
<parameter>
|
||||||
<name>sourceDirectory</name>
|
<name>sourceDirectory</name>
|
||||||
|
@ -83,60 +68,10 @@
|
||||||
<name>classpathElements</name>
|
<name>classpathElements</name>
|
||||||
<expression>#project.classpathElements</expression>
|
<expression>#project.classpathElements</expression>
|
||||||
</parameter>
|
</parameter>
|
||||||
<parameter>
|
|
||||||
<name>compiler</name>
|
|
||||||
<expression>javac</expression>
|
|
||||||
</parameter>
|
|
||||||
</parameters>
|
</parameters>
|
||||||
</goal>
|
|
||||||
</goals>
|
|
||||||
|
|
||||||
|
|
||||||
<goals>
|
|
||||||
<goal>
|
|
||||||
<name>compile</name>
|
|
||||||
<parameters>
|
|
||||||
<parameter>
|
|
||||||
<name>sourceDirectory</name>
|
|
||||||
<expression>#project.build.sourceDirectory</expression>
|
|
||||||
</parameter>
|
|
||||||
<parameter>
|
|
||||||
<name>outputDirectory</name>
|
|
||||||
<expression>#maven.build.dest</expression>
|
|
||||||
</parameter>
|
|
||||||
<parameter>
|
|
||||||
<name>classpathElements</name>
|
|
||||||
<expression>#project.classpathElements</expression>
|
|
||||||
</parameter>
|
|
||||||
<parameter>
|
|
||||||
<name>compiler</name>
|
|
||||||
<expression>javac</expression>
|
|
||||||
</parameter>
|
|
||||||
</parameters>
|
|
||||||
</goal>
|
|
||||||
<goal>
|
|
||||||
<name>test:compile</name>
|
|
||||||
<prereqs>
|
<prereqs>
|
||||||
<prereq>compile</prereq>
|
<prereq>compile</prereq>
|
||||||
</prereqs>
|
</prereqs>
|
||||||
<parameters>
|
|
||||||
<parameter>
|
|
||||||
<name>sourceDirectory</name>
|
|
||||||
<expression>#project.build.unitTestSourceDirectory</expression>
|
|
||||||
</parameter>
|
|
||||||
<parameter>
|
|
||||||
<name>outputDirectory</name>
|
|
||||||
<expression>#maven.test.dest</expression>
|
|
||||||
</parameter>
|
|
||||||
<parameter>
|
|
||||||
<name>classpathElements</name>
|
|
||||||
<expression>#project.classpathElements</expression>
|
|
||||||
</parameter>
|
|
||||||
<parameter>
|
|
||||||
<name>compiler</name>
|
|
||||||
<expression>javac</expression>
|
|
||||||
</parameter>
|
|
||||||
</parameters>
|
|
||||||
</goal>
|
</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</plugin>
|
</plugin>
|
|
@ -10,53 +10,5 @@
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
<name>Maven</name>
|
<name>Maven</name>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<inceptionYear>2001</inceptionYear>
|
|
||||||
<package>org.apache.maven</package>
|
<package>org.apache.maven</package>
|
||||||
<repository>
|
|
||||||
<connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-components/maven-plugins/maven-jar-plugin</connection>
|
|
||||||
<developerConnection>scm:cvs:ext:${maven.username}@cvs.apache.org:/home/cvs:maven-components/maven-plugins/maven-jar-plugin</developerConnection>
|
|
||||||
<url>http://cvs.apache.org/viewcvs.cgi/maven/</url>
|
|
||||||
</repository>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>maven</groupId>
|
|
||||||
<artifactId>maven-core</artifactId>
|
|
||||||
<version>2.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>maven</groupId>
|
|
||||||
<artifactId>maven-model</artifactId>
|
|
||||||
<version>2.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>maven</groupId>
|
|
||||||
<artifactId>maven-project</artifactId>
|
|
||||||
<version>2.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>xpp3</groupId>
|
|
||||||
<artifactId>xpp3</artifactId>
|
|
||||||
<version>1.1.3.3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>plexus</groupId>
|
|
||||||
<artifactId>plexus</artifactId>
|
|
||||||
<version>0.14-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>classworlds</groupId>
|
|
||||||
<artifactId>classworlds</artifactId>
|
|
||||||
<version>1.1-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>xstream</groupId>
|
|
||||||
<artifactId>xstream</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>plexus</groupId>
|
|
||||||
<artifactId>plexus-compiler</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -68,6 +68,20 @@ import java.util.jar.JarOutputStream;
|
||||||
import java.util.jar.Manifest;
|
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 <a href="michal.maczka@dimatics.com">Michal Maczka</a>
|
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
@ -80,17 +94,27 @@ import java.util.jar.Manifest;
|
||||||
* maven.remote.group
|
* maven.remote.group
|
||||||
*/
|
*/
|
||||||
public class JarPlugin
|
public class JarPlugin
|
||||||
|
extends AbstractPlugin
|
||||||
{
|
{
|
||||||
private String jarName;
|
public void execute( PluginExecutionRequest request, PluginExecutionResponse response )
|
||||||
|
|
||||||
private String outputDirectory;
|
|
||||||
|
|
||||||
private String basedir;
|
|
||||||
|
|
||||||
public void execute()
|
|
||||||
throws Exception
|
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" );
|
File jarFile = new File( new File( outputDirectory ), jarName + ".jar" );
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,35 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<id>jar</id>
|
<id>jar</id>
|
||||||
<implementation>org.apache.maven.plugin.JarPlugin</implementation>
|
<implementation>org.apache.maven.plugin.JarPlugin</implementation>
|
||||||
<instantiation-strategy>per-lookup</instantiation-strategy>
|
<instantiationStrategy>singleton</instantiationStrategy>
|
||||||
<mode>field</mode>
|
<mode>integrated</mode>
|
||||||
|
<parameters>
|
||||||
|
<parameter>
|
||||||
|
<name>jarName</name>
|
||||||
|
<type>String</type>
|
||||||
|
<required>false</required>
|
||||||
|
<validator>validator</validator>
|
||||||
|
<description>description </description>
|
||||||
|
</parameter>
|
||||||
|
<parameter>
|
||||||
|
<name>outputDirectory</name>
|
||||||
|
<type>String</type>
|
||||||
|
<required>false</required>
|
||||||
|
<validator>validator</validator>
|
||||||
|
<description>description </description>
|
||||||
|
</parameter>
|
||||||
|
<parameter>
|
||||||
|
<name>basedir</name>
|
||||||
|
<type>String</type>
|
||||||
|
<required>false</required>
|
||||||
|
<validator>validator</validator>
|
||||||
|
<description>description </description>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>
|
<goal>
|
||||||
<name>jar</name>
|
<name>jar</name>
|
||||||
<prereqs>
|
<description>build a jar</description>
|
||||||
<prereq>test</prereq>
|
|
||||||
<prereq>resources</prereq>
|
|
||||||
</prereqs>
|
|
||||||
<parameters>
|
<parameters>
|
||||||
<parameter>
|
<parameter>
|
||||||
<name>jarName</name>
|
<name>jarName</name>
|
||||||
|
@ -24,6 +44,10 @@
|
||||||
<expression>#maven.build.dest</expression>
|
<expression>#maven.build.dest</expression>
|
||||||
</parameter>
|
</parameter>
|
||||||
</parameters>
|
</parameters>
|
||||||
|
<prereqs>
|
||||||
|
<prereq>test</prereq>
|
||||||
|
<prereq>resources</prereq>
|
||||||
|
</prereqs>
|
||||||
</goal>
|
</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</plugin>
|
</plugin>
|
|
@ -9,14 +9,8 @@
|
||||||
<groupId>maven</groupId>
|
<groupId>maven</groupId>
|
||||||
<artifactId>maven-resources-plugin</artifactId>
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
<name>Maven</name>
|
<name>Maven</name>
|
||||||
<currentVersion>1.0-SNAPSHOT</currentVersion>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<inceptionYear>2001</inceptionYear>
|
|
||||||
<package>org.apache.maven</package>
|
<package>org.apache.maven</package>
|
||||||
<repository>
|
|
||||||
<connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-components/maven-plugins/maven-resources-plugin</connection>
|
|
||||||
<developerConnection>scm:cvs:ext:${maven.username}@cvs.apache.org:/home/cvs:maven-components/maven-plugins/maven-resources-plugin</developerConnection>
|
|
||||||
<url>http://cvs.apache.org/viewcvs.cgi/maven/</url>
|
|
||||||
</repository>
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>maven</groupId>
|
<groupId>maven</groupId>
|
||||||
|
@ -33,43 +27,5 @@
|
||||||
<artifactId>maven-project</artifactId>
|
<artifactId>maven-project</artifactId>
|
||||||
<version>2.0-SNAPSHOT</version>
|
<version>2.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>commons-cli</groupId>
|
|
||||||
<artifactId>commons-cli</artifactId>
|
|
||||||
<version>1.0-beta-2</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Plexus -->
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>xpp3</groupId>
|
|
||||||
<artifactId>xpp3</artifactId>
|
|
||||||
<version>1.1.3.3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>plexus</groupId>
|
|
||||||
<artifactId>plexus</artifactId>
|
|
||||||
<version>0.14-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>plexus</groupId>
|
|
||||||
<artifactId>plexus-i18n</artifactId>
|
|
||||||
<version>1.0-beta-2-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>classworlds</groupId>
|
|
||||||
<artifactId>classworlds</artifactId>
|
|
||||||
<version>1.1-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>xstream</groupId>
|
|
||||||
<artifactId>xstream</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>plexus</groupId>
|
|
||||||
<artifactId>plexus-compiler</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -68,30 +68,46 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
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 <a href="michal.maczka@dimatics.com">Michal Maczka</a>
|
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
|
||||||
|
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
||||||
|
*
|
||||||
* @version $Id$
|
* @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
|
public class ResourcesPlugin
|
||||||
|
extends AbstractPlugin
|
||||||
{
|
{
|
||||||
private String outputDirectory;
|
public void execute( PluginExecutionRequest request, PluginExecutionResponse response )
|
||||||
|
|
||||||
private List resources;
|
|
||||||
|
|
||||||
public void execute()
|
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
String outputDirectory = (String) request.getParameter( "outputDirectory" );
|
||||||
|
|
||||||
|
List resources = (List) request.getParameter( "resources" );
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
for ( Iterator i = getJarResources( resources ).iterator(); i.hasNext(); )
|
for ( Iterator i = getJarResources( resources ).iterator(); i.hasNext(); )
|
||||||
{
|
{
|
||||||
ResourceEntry resourceEntry = (ResourceEntry) i.next();
|
ResourceEntry resourceEntry = (ResourceEntry) i.next();
|
||||||
|
|
|
@ -1,11 +1,28 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<id>resource-copier</id>
|
<id>resources</id>
|
||||||
<implementation>org.apache.maven.plugin.ResourcesPlugin</implementation>
|
<implementation>org.apache.maven.plugin.ResourcesPlugin</implementation>
|
||||||
<instantiation-strategy>per-lookup</instantiation-strategy>
|
<instantiationStrategy>singleton</instantiationStrategy>
|
||||||
<mode>field</mode>
|
<mode>integrated</mode>
|
||||||
|
<parameters>
|
||||||
|
<parameter>
|
||||||
|
<name>outputDirectory</name>
|
||||||
|
<type>String</type>
|
||||||
|
<required>false</required>
|
||||||
|
<validator>validator</validator>
|
||||||
|
<description>description </description>
|
||||||
|
</parameter>
|
||||||
|
<parameter>
|
||||||
|
<name>resources</name>
|
||||||
|
<type>List</type>
|
||||||
|
<required>false</required>
|
||||||
|
<validator>validator</validator>
|
||||||
|
<description>description </description>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>
|
<goal>
|
||||||
<name>resources</name>
|
<name>resources</name>
|
||||||
|
<description>copy application resources</description>
|
||||||
<parameters>
|
<parameters>
|
||||||
<parameter>
|
<parameter>
|
||||||
<name>outputDirectory</name>
|
<name>outputDirectory</name>
|
||||||
|
@ -19,6 +36,7 @@
|
||||||
</goal>
|
</goal>
|
||||||
<goal>
|
<goal>
|
||||||
<name>test:resources</name>
|
<name>test:resources</name>
|
||||||
|
<description>copy test resources</description>
|
||||||
<parameters>
|
<parameters>
|
||||||
<parameter>
|
<parameter>
|
||||||
<name>outputDirectory</name>
|
<name>outputDirectory</name>
|
||||||
|
@ -31,4 +49,4 @@
|
||||||
</parameters>
|
</parameters>
|
||||||
</goal>
|
</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</plugin>
|
</plugin>
|
|
@ -9,49 +9,13 @@
|
||||||
<groupId>maven</groupId>
|
<groupId>maven</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<name>Maven</name>
|
<name>Maven</name>
|
||||||
<currentVersion>1.0-SNAPSHOT</currentVersion>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<inceptionYear>2001</inceptionYear>
|
|
||||||
<package>org.apache.maven</package>
|
<package>org.apache.maven</package>
|
||||||
<repository>
|
|
||||||
<connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-components/maven-plugins/maven-surefire-plugin</connection>
|
|
||||||
<developerConnection>scm:cvs:ext:${maven.username}@cvs.apache.org:/home/cvs:maven-components/maven-plugins/maven-surefire-plugin</developerConnection>
|
|
||||||
<url>http://cvs.apache.org/viewcvs.cgi/maven/</url>
|
|
||||||
</repository>
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>surefire</groupId>
|
<groupId>surefire</groupId>
|
||||||
<artifactId>surefire-booter</artifactId>
|
<artifactId>surefire-booter</artifactId>
|
||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>maven</groupId>
|
|
||||||
<artifactId>maven-core</artifactId>
|
|
||||||
<version>2.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>xpp3</groupId>
|
|
||||||
<artifactId>xpp3</artifactId>
|
|
||||||
<version>1.1.3.3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>plexus</groupId>
|
|
||||||
<artifactId>plexus</artifactId>
|
|
||||||
<version>0.14-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>plexus</groupId>
|
|
||||||
<artifactId>plexus-i18n</artifactId>
|
|
||||||
<version>1.0-beta-2-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>classworlds</groupId>
|
|
||||||
<artifactId>classworlds</artifactId>
|
|
||||||
<version>1.1-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>xstream</groupId>
|
|
||||||
<artifactId>xstream</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -9,20 +9,39 @@ import java.io.File;
|
||||||
import java.util.List;
|
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 <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
*
|
||||||
* @todo make version of junit and surefire configurable
|
* @todo make version of junit and surefire configurable
|
||||||
* @todo make report to be produced configurable
|
* @todo make report to be produced configurable
|
||||||
*/
|
*/
|
||||||
public class SurefirePlugin
|
public class SurefirePlugin
|
||||||
extends AbstractPlugin
|
extends AbstractPlugin
|
||||||
{
|
{
|
||||||
|
|
||||||
public void execute( PluginExecutionRequest request, PluginExecutionResponse response )
|
public void execute( PluginExecutionRequest request, PluginExecutionResponse response )
|
||||||
throws Exception
|
throws Exception
|
||||||
|
|
||||||
//public void execute( String mavenRepoLocal, String basedir, List includes, List excludes, String[] classpathElements )
|
|
||||||
// throws Exception
|
|
||||||
{
|
{
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,16 +1,49 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<id>surefire</id>
|
<id>surefire</id>
|
||||||
<implementation>org.apache.maven.test.SurefirePlugin</implementation>
|
<implementation>org.apache.maven.test.SurefirePlugin</implementation>
|
||||||
<instantiation-strategy>singleton</instantiation-strategy>
|
<instantiationStrategy>singleton</instantiationStrategy>
|
||||||
<mode>integrated</mode>
|
<mode>integrated</mode>
|
||||||
|
<parameters>
|
||||||
|
<parameter>
|
||||||
|
<name>mavenRepoLocal</name>
|
||||||
|
<type>String</type>
|
||||||
|
<required>false</required>
|
||||||
|
<validator>validator</validator>
|
||||||
|
<description></description>
|
||||||
|
</parameter>
|
||||||
|
<parameter>
|
||||||
|
<name>basedir</name>
|
||||||
|
<type>String</type>
|
||||||
|
<required>false</required>
|
||||||
|
<validator>validator</validator>
|
||||||
|
<description></description>
|
||||||
|
</parameter>
|
||||||
|
<parameter>
|
||||||
|
<name>includes</name>
|
||||||
|
<type>String</type>
|
||||||
|
<required>false</required>
|
||||||
|
<validator>validator</validator>
|
||||||
|
<description></description>
|
||||||
|
</parameter>
|
||||||
|
<parameter>
|
||||||
|
<name>excludes</name>
|
||||||
|
<type>String</type>
|
||||||
|
<required>false</required>
|
||||||
|
<validator>validator</validator>
|
||||||
|
<description></description>
|
||||||
|
</parameter>
|
||||||
|
<parameter>
|
||||||
|
<name>classpathElements</name>
|
||||||
|
<type>String[]</type>
|
||||||
|
<required>false</required>
|
||||||
|
<validator>validator</validator>
|
||||||
|
<description></description>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>
|
<goal>
|
||||||
<name>test</name>
|
<name>test</name>
|
||||||
<prereqs>
|
<description>Run tests using surefire</description>
|
||||||
<prereq>test:compile</prereq>
|
|
||||||
<prereq>resources</prereq>
|
|
||||||
<prereq>test:resources</prereq>
|
|
||||||
</prereqs>
|
|
||||||
<parameters>
|
<parameters>
|
||||||
<parameter>
|
<parameter>
|
||||||
<name>mavenRepoLocal</name>
|
<name>mavenRepoLocal</name>
|
||||||
|
@ -33,6 +66,11 @@
|
||||||
<expression>#project.classpathElements</expression>
|
<expression>#project.classpathElements</expression>
|
||||||
</parameter>
|
</parameter>
|
||||||
</parameters>
|
</parameters>
|
||||||
|
<prereqs>
|
||||||
|
<prereq>test:compile</prereq>
|
||||||
|
<prereq>resources</prereq>
|
||||||
|
<prereq>test:resources</prereq>
|
||||||
|
</prereqs>
|
||||||
</goal>
|
</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</plugin>
|
</plugin>
|
Loading…
Reference in New Issue