org.apache.maven.plugin.jar
Class AbstractJarMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by 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
AbstractJarMojo()
           
 
Method Summary
 File createArchive()
          Generates the JAR.
 void execute()
          Generates the JAR.
protected abstract  File getClassesDirectory()
          Return the specific output directory to serve as the root for the archive.
protected abstract  String getClassifier()
          Overload this to produce a jar with another classifier, for example a test-jar.
protected  File getDefaultManifestFile()
          Default Manifest location.
protected static File getJarFile(File basedir, String finalName, String classifier)
           
protected  org.apache.maven.project.MavenProject getProject()
           
protected abstract  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 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 String getClassifier()
Overload this to produce a jar with another classifier, for example a test-jar.


getType

protected abstract String getType()
Overload this to produce a test-jar, for example.


getJarFile

protected static File getJarFile(File basedir,
                                 String finalName,
                                 String classifier)

getDefaultManifestFile

protected File getDefaultManifestFile()
Default Manifest location. Can point to a non existing file. Cannot return null.


createArchive

public 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


Copyright © 2002-2011 The Apache Software Foundation. All Rights Reserved.