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
This commit is contained in:
Jason van Zyl 2004-06-11 16:14:40 +00:00
parent dd4fc3384f
commit 072609e0b3
8 changed files with 138 additions and 166 deletions

View File

@ -19,16 +19,19 @@ package org.apache.maven.plugin;
import java.io.File;
/**
* @author <a href="mailto:evenisse@maven.org">Emmanuel Venisse</a>
* @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 <a href="mailto:evenisse@maven.org">Emmanuel Venisse</a>
* @version $Id$
*/
public class CleanPlugin
extends AbstractPlugin

View File

@ -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 <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @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!" );
}
}
}

View File

@ -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

View File

@ -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 <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id$

View File

@ -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 <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @version $Id$

View File

@ -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 <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
@ -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 )

View File

@ -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
* <http://www.apache.org/>.
*
* ====================================================================
*/
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 <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
*
* @version $Id$
*
*/
public class TestResourcesMojo
extends ResourcesMojo
{
}

View File

@ -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 <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @version $Id$