org.apache.maven.plugin.jar

## Class AbstractJarMojo

- java.lang.Object
- - org.apache.maven.plugin.AbstractMojo
  - - org.apache.maven.plugin.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: AbstractJarMojo.java 1158941 2011-08-17 22:22:17Z rfscholte $
Author:
  Emmanuel Venisse

### Field Summary

### Fields inherited from interface org.apache.maven.plugin.Mojo

`ROLE`

### Constructor Summary

Constructors
Constructor and Description
`AbstractJarMojo()`

### Method Summary

Methods
`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.
`protected java.io.File` `getDefaultManifestFile()` Default Manifest location.
`protected static java.io.File` `getJarFile(java.io.File basedir, java.lang.String finalName, java.lang.String classifier)`
`protected org.apache.maven.project.MavenProject` `getProject()`
`protected abstract java.lang.String` `getType()` Overload this to produce a test-jar, for example.

### Methods inherited from class org.apache.maven.plugin.AbstractMojo

`getLog, getPluginContext, setLog, setPluginContext`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### AbstractJarMojo

    public AbstractJarMojo()

### Method Detail

#### getClassesDirectory

    protected abstract java.io.File getClassesDirectory()

Return the specific output directory to serve as the root for the archive.

#### getProject

    protected final org.apache.maven.project.MavenProject getProject()

#### getClassifier

    protected abstract java.lang.String getClassifier()

Overload this to produce a jar with another classifier, for example a test-jar.

#### getType

    protected abstract java.lang.String getType()

Overload this to produce a test-jar, for example.

#### getJarFile

    protected static java.io.File getJarFile(java.io.File basedir,
                          java.lang.String finalName,
                          java.lang.String classifier)

#### getDefaultManifestFile

    protected java.io.File getDefaultManifestFile()

Default Manifest location. Can point to a non existing file. Cannot return null.

#### createArchive

    public java.io.File createArchive()
                               throws org.apache.maven.plugin.MojoExecutionException

Generates the JAR.

Throws:
  `org.apache.maven.plugin.MojoExecutionException`

#### execute

    public void execute()
                 throws org.apache.maven.plugin.MojoExecutionException

Generates the JAR.

Throws:
  `org.apache.maven.plugin.MojoExecutionException`