From ee951b16093bdbfc264108732cd894e83097d3ab Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Mon, 15 Mar 2004 19:32:20 +0000 Subject: [PATCH] Initial revision git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@162606 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven-compiler-plugin/.cvsignore | 5 + .../maven-compiler-plugin/project.xml | 72 ++++++ .../apache/maven/plugin/CompilerPlugin.java | 88 +++++++ .../main/resources/META-INF/maven/plugin.xml | 33 +++ maven-plugins/maven-jar-plugin/.cvsignore | 5 + maven-plugins/maven-jar-plugin/project.xml | 93 +++++++ .../org/apache/maven/plugin/JarPlugin.java | 163 +++++++++++++ .../main/resources/META-INF/maven/plugin.xml | 18 ++ .../maven-resources-plugin/.cvsignore | 5 + .../maven-resources-plugin/project.xml | 131 ++++++++++ .../apache/maven/plugin/ResourcesPlugin.java | 226 ++++++++++++++++++ .../main/resources/META-INF/maven/plugin.xml | 20 ++ .../maven-surefire-plugin/.cvsignore | 7 + .../maven-surefire-plugin/project.xml | 99 ++++++++ .../org/apache/maven/test/SurefirePlugin.java | 53 ++++ .../main/resources/META-INF/maven/plugin.xml | 76 ++++++ 16 files changed, 1094 insertions(+) create mode 100644 maven-plugins/maven-compiler-plugin/.cvsignore create mode 100644 maven-plugins/maven-compiler-plugin/project.xml create mode 100644 maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/CompilerPlugin.java create mode 100644 maven-plugins/maven-compiler-plugin/src/main/resources/META-INF/maven/plugin.xml create mode 100644 maven-plugins/maven-jar-plugin/.cvsignore create mode 100644 maven-plugins/maven-jar-plugin/project.xml create mode 100644 maven-plugins/maven-jar-plugin/src/main/java/org/apache/maven/plugin/JarPlugin.java create mode 100644 maven-plugins/maven-jar-plugin/src/main/resources/META-INF/maven/plugin.xml create mode 100644 maven-plugins/maven-resources-plugin/.cvsignore create mode 100644 maven-plugins/maven-resources-plugin/project.xml create mode 100644 maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/ResourcesPlugin.java create mode 100644 maven-plugins/maven-resources-plugin/src/main/resources/META-INF/maven/plugin.xml create mode 100644 maven-plugins/maven-surefire-plugin/.cvsignore create mode 100644 maven-plugins/maven-surefire-plugin/project.xml create mode 100644 maven-plugins/maven-surefire-plugin/src/main/java/org/apache/maven/test/SurefirePlugin.java create mode 100644 maven-plugins/maven-surefire-plugin/src/main/resources/META-INF/maven/plugin.xml diff --git a/maven-plugins/maven-compiler-plugin/.cvsignore b/maven-plugins/maven-compiler-plugin/.cvsignore new file mode 100644 index 0000000000..7da1cadc3d --- /dev/null +++ b/maven-plugins/maven-compiler-plugin/.cvsignore @@ -0,0 +1,5 @@ +*~ +*.log +target +*.ipr +*.iws diff --git a/maven-plugins/maven-compiler-plugin/project.xml b/maven-plugins/maven-compiler-plugin/project.xml new file mode 100644 index 0000000000..93406c33a4 --- /dev/null +++ b/maven-plugins/maven-compiler-plugin/project.xml @@ -0,0 +1,72 @@ + + + + 3 + maven-compiler-plugin + maven-compiler-plugin + maven-compiler-plugin + Maven + 1.0-SNAPSHOT + + Apache Software Foundation + http://www.apache.org/ + /images/apache-maven-project.png + + 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 + + + + + src/main/java + src/test/java + + + **/*Test.java + + + + + src/main/resources + + + + 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 new file mode 100644 index 0000000000..75b8347613 --- /dev/null +++ b/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/CompilerPlugin.java @@ -0,0 +1,88 @@ +package org.apache.maven.plugin; + +import org.codehaus.plexus.compiler.Compiler; +import org.codehaus.plexus.compiler.CompilerError; + +import java.util.List; +import java.util.Map; +import java.util.Iterator; +import java.io.File; + +/** + * @author Jason van Zyl + * + * @version $Id$ + */ + +// Conditions underwhich we fail +// - specified source directory does not exist +// - missing classpath Elements +// - compilation error + +// How to accurately report failures to users + +public class CompilerPlugin +{ + private Map compilers; + + private String sourceDirectory; + + private String outputDirectory; + + private String[] classpathElements; + + private String compiler; + + private boolean debug = true; + + public void execute() + throws Exception + { + if ( ! new File( sourceDirectory ).exists() ) + { + throw new Exception( "The specified source directory '"+ sourceDirectory + "' does not exist!" ); + } + + Compiler compiler = (Compiler) compilers.get( this.compiler ); + + 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-compiler-plugin/src/main/resources/META-INF/maven/plugin.xml b/maven-plugins/maven-compiler-plugin/src/main/resources/META-INF/maven/plugin.xml new file mode 100644 index 0000000000..4635e17b6c --- /dev/null +++ b/maven-plugins/maven-compiler-plugin/src/main/resources/META-INF/maven/plugin.xml @@ -0,0 +1,33 @@ + + compiler + org.apache.maven.plugin.CompilerPlugin + + + org.codehaus.plexus.compiler.Compiler + compilers + + + + + compile + + #project.build.sourceDirectory + #maven.build.dest + #project.classpathElements + javac + + + + test:compile + + compile + + + #project.build.unitTestSourceDirectory + #maven.test.dest + #project.classpathElements + javac + + + + diff --git a/maven-plugins/maven-jar-plugin/.cvsignore b/maven-plugins/maven-jar-plugin/.cvsignore new file mode 100644 index 0000000000..7da1cadc3d --- /dev/null +++ b/maven-plugins/maven-jar-plugin/.cvsignore @@ -0,0 +1,5 @@ +*~ +*.log +target +*.ipr +*.iws diff --git a/maven-plugins/maven-jar-plugin/project.xml b/maven-plugins/maven-jar-plugin/project.xml new file mode 100644 index 0000000000..3ee0c9a80e --- /dev/null +++ b/maven-plugins/maven-jar-plugin/project.xml @@ -0,0 +1,93 @@ + + + + 3 + maven-jar-plugin + maven + maven-jar-plugin + Maven + 1.0-SNAPSHOT + + Apache Software Foundation + http://www.apache.org/ + /images/apache-maven-project.png + + 2001 + org.apache.maven + /images/maven.gif + + + 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 + + + + + src/main/java + src/test/java + + + **/*Test.java + + + + + src/main/resources + + + + + + maven-faq-plugin will run by itself but won't register + maven-file-activity-plugin can't parse jelly script + maven-developer-activity-plugin + maven-tasklist-plugin not quite right the report comes out empty @tag problem? + maven-jdepend-plugin works itself but not with site, also it uses maven-classpath which is really just maven_home/lib + maven-jellydoc-plugin ${genDocs} not available in jelly.plugin + maven-pmd-plugin classpath is borked because of getDependencyPath("foo:foo") + + + 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 new file mode 100644 index 0000000000..f2b949a93b --- /dev/null +++ b/maven-plugins/maven-jar-plugin/src/main/java/org/apache/maven/plugin/JarPlugin.java @@ -0,0 +1,163 @@ +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.codehaus.plexus.util.FileUtils; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.List; +import java.util.jar.JarEntry; +import java.util.jar.JarOutputStream; +import java.util.jar.Manifest; + +/** + * + * @author Michal Maczka + * @version $Id$ + * + * maven.jar.manifest.extensions.add + * maven.jar.includes + * maven.jar.excludes + * maven.jar.index + * maven.jar.compress + * maven.remote.group + */ +public class JarPlugin +{ + private String jarName; + + private String outputDirectory; + + private String basedir; + + public void execute() + throws Exception + { + File basedir = new File( this.basedir ); + + File jarFile = new File( new File( outputDirectory ), jarName + ".jar" ); + + List files = FileUtils.getFileNames( basedir, "**/**", "**/package.html", false ); + + createJar( files, jarFile, basedir ); + } + + public void createJar( List files, File jarName, File basedir ) + throws Exception + { + JarOutputStream jar = new JarOutputStream( new FileOutputStream( jarName ), createManifest() ); + + try + { + for ( int i = 0; i < files.size(); i++ ) + { + String file = (String) files.get( i ); + + writeJarEntry( jar, new File( basedir, file ), file ); + } + } + finally + { + jar.close(); + } + } + + private void writeJarEntry( JarOutputStream jar, File source, String entryName ) + throws Exception + { + byte[] buffer = new byte[1024]; + + int bytesRead; + + try + { + FileInputStream is = new FileInputStream( source ); + + try + { + JarEntry entry = new JarEntry( entryName ); + + jar.putNextEntry( entry ); + + while ( ( bytesRead = is.read( buffer ) ) != -1 ) + { + jar.write( buffer, 0, bytesRead ); + } + } + catch ( Exception ex ) + { + } + finally + { + is.close(); + } + } + catch ( IOException ex ) + { + } + } + + private Manifest createManifest() + { + Manifest manifest = new Manifest(); + + return manifest; + } +} 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 new file mode 100644 index 0000000000..66d4249807 --- /dev/null +++ b/maven-plugins/maven-jar-plugin/src/main/resources/META-INF/maven/plugin.xml @@ -0,0 +1,18 @@ + + jar + org.apache.maven.plugin.JarPlugin + + + jar + + test + resources + + + #maven.final.name + #maven.build.dir + #maven.build.dest + + + + diff --git a/maven-plugins/maven-resources-plugin/.cvsignore b/maven-plugins/maven-resources-plugin/.cvsignore new file mode 100644 index 0000000000..7da1cadc3d --- /dev/null +++ b/maven-plugins/maven-resources-plugin/.cvsignore @@ -0,0 +1,5 @@ +*~ +*.log +target +*.ipr +*.iws diff --git a/maven-plugins/maven-resources-plugin/project.xml b/maven-plugins/maven-resources-plugin/project.xml new file mode 100644 index 0000000000..f512f21770 --- /dev/null +++ b/maven-plugins/maven-resources-plugin/project.xml @@ -0,0 +1,131 @@ + + + + 3 + maven-resources-plugin + maven + maven-resources-plugin + Maven + 1.0-SNAPSHOT + + Apache Software Foundation + http://www.apache.org/ + /images/apache-maven-project.png + + 2001 + org.apache.maven + /images/maven.gif + + + + + + + + + + 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 + maven-core + 2.0-SNAPSHOT + + + + maven + maven-model + 2.0-SNAPSHOT + + + + maven + maven-model-xpp3 + 2.0-SNAPSHOT + + + + maven + 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 + + + + + + src/main/java + src/test/java + + + **/*Test.java + + + + + src/main/resources + + + + + + maven-faq-plugin will run by itself but won't register + maven-file-activity-plugin can't parse jelly script + maven-developer-activity-plugin + maven-tasklist-plugin not quite right the report comes out empty @tag problem? + maven-jdepend-plugin works itself but not with site, also it uses maven-classpath which is really just maven_home/lib + maven-jellydoc-plugin ${genDocs} not available in jelly.plugin + maven-pmd-plugin classpath is borked because of getDependencyPath("foo:foo") + + + 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 new file mode 100644 index 0000000000..89d08956d8 --- /dev/null +++ b/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/ResourcesPlugin.java @@ -0,0 +1,226 @@ +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; + +/** + * + * @author Michal Maczka + * @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 +{ + private String outputDirectory; + + private List resources; + + public void execute() + throws Exception + { + for ( Iterator i = getJarResources( resources ).iterator(); i.hasNext(); ) + { + ResourceEntry resourceEntry = (ResourceEntry) i.next(); + + File destinationFile = new File( outputDirectory, resourceEntry.getDestination() ); + + if ( !destinationFile.getParentFile().exists() ) + { + destinationFile.getParentFile().mkdirs(); + } + + fileCopy( resourceEntry.getSource(), destinationFile.getPath() ); + } + } + + private List getJarResources( List resources ) + throws Exception + { + List resourceEntries = new ArrayList(); + + for ( Iterator i = resources.iterator(); i.hasNext(); ) + { + Resource resource = (Resource) i.next(); + + String targetPath = resource.getTargetPath(); + + File resourceDirectory = new File( resource.getDirectory() ); + + if ( !resourceDirectory.exists() ) + { + continue; + } + + List files = FileUtils.getFileNames( resourceDirectory, + listToString( resource.getIncludes() ), + listToString( resource.getExcludes() ), + false ); + + for ( Iterator j = files.iterator(); j.hasNext(); ) + { + String name = (String) j.next(); + + String entryName = name; + ; + + if ( targetPath != null ) + { + entryName = targetPath + "/" + name; + } + + ResourceEntry je = new ResourceEntry( new File( resource.getDirectory(), name ).getPath(), entryName ); + + resourceEntries.add( je ); + } + } + + return resourceEntries; + } + + private String listToString( List list ) + { + StringBuffer sb = new StringBuffer(); + + for ( int i = 0; i < list.size(); i++ ) + { + sb.append( list.get( i ) ); + + if ( i != list.size() - 1 ) + { + sb.append( "," ); + } + } + + return sb.toString(); + } + + public static String fileRead( String fileName ) throws IOException + { + StringBuffer buf = new StringBuffer(); + + FileInputStream in = new FileInputStream( fileName ); + + int count; + byte[] b = new byte[512]; + while ( ( count = in.read( b ) ) > 0 ) // blocking read + { + buf.append( new String( b, 0, count ) ); + } + + in.close(); + + return buf.toString(); + } + + public static void fileWrite( String fileName, String data ) throws Exception + { + FileOutputStream out = new FileOutputStream( fileName ); + out.write( data.getBytes() ); + out.close(); + } + + public static void fileCopy( String inFileName, String outFileName ) throws + Exception + { + String content = fileRead( inFileName ); + fileWrite( outFileName, content ); + } + + class ResourceEntry + { + private String source; + + private String destination; + + public ResourceEntry( String source, String entry ) + { + this.source = source; + + this.destination = entry; + } + + public String getSource() + { + return source; + } + + public String getDestination() + { + return destination; + } + } +} 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 new file mode 100644 index 0000000000..ea502b1cc0 --- /dev/null +++ b/maven-plugins/maven-resources-plugin/src/main/resources/META-INF/maven/plugin.xml @@ -0,0 +1,20 @@ + + resource-copier + org.apache.maven.plugin.ResourcesPlugin + + + resources + + #maven.build.dest + #project.build.resources + + + + test:resources + + #maven.test.dest + #project.build.unitTest.resources + + + + diff --git a/maven-plugins/maven-surefire-plugin/.cvsignore b/maven-plugins/maven-surefire-plugin/.cvsignore new file mode 100644 index 0000000000..8eeb0ff8ae --- /dev/null +++ b/maven-plugins/maven-surefire-plugin/.cvsignore @@ -0,0 +1,7 @@ +target +velocity.log +maven.log +.classpath +.project +*.ipr +*.iws diff --git a/maven-plugins/maven-surefire-plugin/project.xml b/maven-plugins/maven-surefire-plugin/project.xml new file mode 100644 index 0000000000..413bd5ad9b --- /dev/null +++ b/maven-plugins/maven-surefire-plugin/project.xml @@ -0,0 +1,99 @@ + + + + 3 + maven-surefire-plugin + maven + maven-surefire-plugin + Maven + 1.0-SNAPSHOT + + Apache Software Foundation + http://www.apache.org/ + /images/apache-maven-project.png + + 2001 + org.apache.maven + /images/maven.gif + + + + + + + + + + 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 + + + + + + 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 + + + + + + dev@maven.apache.org + src/main/java + src/test/java + + + **/*Test.java + + + + + src/main/resources + + + + + + maven-jxr-plugin + maven-javadoc-plugin + maven-changes-plugin + maven-changelog-plugin + + + 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 new file mode 100644 index 0000000000..06eaacb373 --- /dev/null +++ b/maven-plugins/maven-surefire-plugin/src/main/java/org/apache/maven/test/SurefirePlugin.java @@ -0,0 +1,53 @@ +package org.apache.maven.test; + +import org.codehaus.surefire.SurefireBooter; + +import java.io.File; +import java.util.List; + +/** + * + * + * @author Jason van Zyl + * + * @version $Id$ + */ +public class SurefirePlugin +{ + private String mavenRepoLocal; + + private String basedir; + + private List includes; + + private List excludes; + + private String[] classpathElements; + + public void execute() + throws Exception + { + System.setProperty( "basedir", basedir ); + + SurefireBooter surefireBooter = new SurefireBooter(); + + surefireBooter.addBattery( "org.codehaus.surefire.battery.DirectoryBattery", new Object[]{basedir, includes, excludes} ); + + surefireBooter.addClassPathUrl( new File( mavenRepoLocal, "junit/jars/junit-3.8.1.jar" ).getPath() ); + + surefireBooter.addClassPathUrl( new File( mavenRepoLocal, "surefire/jars/surefire-1.0.jar" ).getPath() ); + + surefireBooter.addClassPathUrl( new File( basedir, "target/classes" ).getPath() ); + + surefireBooter.addClassPathUrl( new File( basedir, "target/test-classes" ).getPath() ); + + for ( int i = 0; i < classpathElements.length; i++ ) + { + surefireBooter.addClassPathUrl( classpathElements[i] ); + } + + surefireBooter.addReport( "org.codehaus.surefire.report.ConsoleReport" ); + + surefireBooter.run(); + } +} 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 new file mode 100644 index 0000000000..c58488404b --- /dev/null +++ b/maven-plugins/maven-surefire-plugin/src/main/resources/META-INF/maven/plugin.xml @@ -0,0 +1,76 @@ + + + surefire + org.apache.maven.test.SurefirePlugin + + + test + + test:compile + test:resources + + + #maven.repo.local + #basedir + #project.build.unitTest.includes + #project.build.unitTest.excludes + #project.classpathElements + + + + \ No newline at end of file