Package org.apache.maven.plugins.jar
Class TestJarMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.plugins.jar.AbstractJarMojo
-
- org.apache.maven.plugins.jar.TestJarMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="test-jar", defaultPhase=PACKAGE, requiresProject=true, threadSafe=true, requiresDependencyResolution=TEST) public class TestJarMojo extends AbstractJarMojoBuild a JAR of the test classes for the current project.- Version:
- $Id$
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringclassifierClassifier to used fortest-jar.private booleanskipSet this totrueto bypass test-jar generation.private java.io.FiletestClassesDirectoryDirectory containing the test classes and resource files that should be packaged into the JAR.
-
Constructor Summary
Constructors Constructor Description TestJarMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute()Generates the JAR.protected java.io.FilegetClassesDirectory()Return the specific output directory to serve as the root for the archive.protected java.lang.StringgetClassifier()Overload this to produce a jar with another classifier, for example a test-jar.protected java.lang.StringgetType()Overload this to produce a test-jar, for example.-
Methods inherited from class org.apache.maven.plugins.jar.AbstractJarMojo
createArchive, getJarFile, getProject, hasClassifier
-
-
-
-
Field Detail
-
skip
@Parameter(property="maven.test.skip") private boolean skip
Set this totrueto bypass test-jar generation. Its use is NOT RECOMMENDED, but quite convenient on occasion.
-
testClassesDirectory
@Parameter(defaultValue="${project.build.testOutputDirectory}", required=true) private java.io.File testClassesDirectoryDirectory containing the test classes and resource files that should be packaged into the JAR.
-
classifier
@Parameter(defaultValue="tests") private java.lang.String classifier
Classifier to used fortest-jar.
-
-
Method Detail
-
getClassifier
protected java.lang.String getClassifier()
Overload this to produce a jar with another classifier, for example a test-jar.- Specified by:
getClassifierin classAbstractJarMojo- Returns:
- get the classifier.
-
getType
protected java.lang.String getType()
Overload this to produce a test-jar, for example.- Specified by:
getTypein classAbstractJarMojo- Returns:
- return the type.
-
getClassesDirectory
protected java.io.File getClassesDirectory()
Return the specific output directory to serve as the root for the archive.- Specified by:
getClassesDirectoryin classAbstractJarMojo- Returns:
- get classes directory.
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionExceptionGenerates the JAR.- Specified by:
executein interfaceorg.apache.maven.plugin.Mojo- Overrides:
executein classAbstractJarMojo- Throws:
org.apache.maven.plugin.MojoExecutionException- in case of an error.
-
-