public abstract class AbstractJarMojo
extends org.apache.maven.plugin.AbstractMojo
Modifier and Type | Field and Description |
---|---|
private org.apache.maven.archiver.MavenArchiveConfiguration |
archive
The archive configuration to use.
|
private java.util.Map<java.lang.String,org.codehaus.plexus.archiver.Archiver> |
archivers
The Jar archiver.
|
private static java.lang.String[] |
DEFAULT_EXCLUDES |
private static java.lang.String[] |
DEFAULT_INCLUDES |
private java.lang.String[] |
excludes
List of files to exclude.
|
private java.lang.String |
finalName
Name of the generated JAR.
|
private boolean |
forceCreation
Require the jar plugin to build a new JAR even if none of the contents appear to have changed.
|
private java.lang.String[] |
includes
List of files to include.
|
private static java.lang.String |
MODULE_DESCRIPTOR_FILE_NAME |
private java.io.File |
outputDirectory
Directory containing the generated JAR.
|
private org.apache.maven.project.MavenProject |
project
The {MavenProject}.
|
private org.apache.maven.project.MavenProjectHelper |
projectHelper |
private org.apache.maven.execution.MavenSession |
session
The
MavenSession . |
private boolean |
skipIfEmpty
Skip creating empty archives.
|
private boolean |
useDefaultManifestFile
Deprecated.
For version 3.0.0 this parameter is only defined here to break the build if you use it!
|
Constructor and Description |
---|
AbstractJarMojo() |
Modifier and Type | Method and Description |
---|---|
java.io.File |
createArchive()
Generates the JAR.
|
void |
execute()
Generates the JAR.
|
protected abstract java.io.File |
getClassesDirectory()
Return the specific output directory to serve as the root for the archive.
|
protected abstract java.lang.String |
getClassifier()
Overload this to produce a jar with another classifier, for example a test-jar.
|
private java.lang.String[] |
getExcludes() |
private java.lang.String[] |
getIncludes() |
protected java.io.File |
getJarFile(java.io.File basedir,
java.lang.String resultFinalName,
java.lang.String classifier)
Returns the Jar file to generate, based on an optional classifier.
|
protected org.apache.maven.project.MavenProject |
getProject() |
protected abstract java.lang.String |
getType()
Overload this to produce a test-jar, for example.
|
protected boolean |
hasClassifier() |
private boolean |
projectHasAlreadySetAnArtifact() |
private static final java.lang.String[] DEFAULT_EXCLUDES
private static final java.lang.String[] DEFAULT_INCLUDES
private static final java.lang.String MODULE_DESCRIPTOR_FILE_NAME
@Parameter private java.lang.String[] includes
@Parameter private java.lang.String[] excludes
@Parameter(defaultValue="${project.build.directory}", required=true) private java.io.File outputDirectory
@Parameter(defaultValue="${project.build.finalName}", readonly=true) private java.lang.String finalName
@Component private java.util.Map<java.lang.String,org.codehaus.plexus.archiver.Archiver> archivers
@Parameter(defaultValue="${project}", readonly=true, required=true) private org.apache.maven.project.MavenProject project
@Parameter(defaultValue="${session}", readonly=true, required=true) private org.apache.maven.execution.MavenSession session
MavenSession
.@Parameter private org.apache.maven.archiver.MavenArchiveConfiguration archive
@Parameter(property="jar.useDefaultManifestFile", defaultValue="false") private boolean useDefaultManifestFile
@Component private org.apache.maven.project.MavenProjectHelper projectHelper
@Parameter(property="maven.jar.forceCreation", defaultValue="false") private boolean forceCreation
jar.forceCreation
to
maven.jar.forceCreation
.@Parameter(defaultValue="false") private boolean skipIfEmpty
protected abstract java.io.File getClassesDirectory()
protected final org.apache.maven.project.MavenProject getProject()
project
protected abstract java.lang.String getClassifier()
protected abstract java.lang.String getType()
protected java.io.File getJarFile(java.io.File basedir, java.lang.String resultFinalName, java.lang.String classifier)
basedir
- the output directoryresultFinalName
- the name of the ear fileclassifier
- an optional classifierpublic java.io.File createArchive() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
- in case of an error.public void execute() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
- in case of an error.private boolean projectHasAlreadySetAnArtifact()
protected boolean hasClassifier()
null
and contains something else than white spaces.private java.lang.String[] getIncludes()
private java.lang.String[] getExcludes()