Package org.apache.maven.plugins.jar
Class AbstractJarMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.maven.plugins.jar.AbstractJarMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
JarMojo,TestJarMojo
public abstract class AbstractJarMojo
extends org.apache.maven.plugin.AbstractMojo
Base class for creating a jar from project classes.
- Version:
- $Id$
- Author:
- Emmanuel Venisse
-
Field Summary
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGenerates the JAR.voidexecute()Generates the JAR.protected abstract FileReturn the specific output directory to serve as the root for the archive.protected abstract StringOverload this to produce a jar with another classifier, for example a test-jar.protected FilegetJarFile(File basedir, String resultFinalName, String classifier) Returns the Jar file to generate, based on an optional classifier.protected final org.apache.maven.project.MavenProjectReturn theMavenProjectprotected abstract StringgetType()Overload this to produce a test-jar, for example.protected booleanReturntruein case where the classifier is notnulland contains something else than white spaces.Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Constructor Details
-
AbstractJarMojo
public AbstractJarMojo()
-
-
Method Details
-
getClassesDirectory
Return the specific output directory to serve as the root for the archive.- Returns:
- get classes directory.
-
getProject
protected final org.apache.maven.project.MavenProject getProject()Return theMavenProject- Returns:
- the MavenProject.
-
getClassifier
Overload this to produce a jar with another classifier, for example a test-jar.- Returns:
- get the classifier.
-
getType
Overload this to produce a test-jar, for example.- Returns:
- return the type.
-
getJarFile
Returns the Jar file to generate, based on an optional classifier.- Parameters:
basedir- the output directoryresultFinalName- the name of the ear fileclassifier- an optional classifier- Returns:
- the file to generate
-
createArchive
Generates the JAR.- Returns:
- The instance of File for the created archive file.
- Throws:
org.apache.maven.plugin.MojoExecutionException- in case of an error.
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionExceptionGenerates the JAR.- Throws:
org.apache.maven.plugin.MojoExecutionException- in case of an error.
-
hasClassifier
protected boolean hasClassifier()Returntruein case where the classifier is notnulland contains something else than white spaces.- Returns:
trueif the classifier is set.
-