Class JarMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

    @Mojo(name="jar",
          defaultPhase=PACKAGE,
          requiresProject=true,
          threadSafe=true,
          requiresDependencyResolution=RUNTIME)
    public class JarMojo
    extends AbstractJarMojo
    Build a JAR from the current project.
    Version:
    $Id$
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.io.File classesDirectory
      Directory containing the classes and resource files that should be packaged into the JAR.
      private java.lang.String classifier
      Classifier to add to the artifact generated.
      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Constructor Summary

      Constructors 
      Constructor Description
      JarMojo()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.io.File getClassesDirectory()
      Return the specific output directory to serve as the root for the archive.
      protected java.lang.String getClassifier()
      Overload this to produce a jar with another classifier, for example a test-jar.
      protected 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
    • Field Detail

      • classesDirectory

        @Parameter(defaultValue="${project.build.outputDirectory}",
                   required=true)
        private java.io.File classesDirectory
        Directory containing the classes and resource files that should be packaged into the JAR.
      • classifier

        @Parameter
        private java.lang.String classifier
        Classifier to add to the artifact generated. If given, the artifact will be attached as a supplemental artifact. If not given this will create the main artifact which is the default behavior. If you try to do that a second time without using a classifier the build will fail.
    • Constructor Detail

      • JarMojo

        public JarMojo()
    • Method Detail

      • getClassifier

        protected java.lang.String getClassifier()
        Overload this to produce a jar with another classifier, for example a test-jar.
        Specified by:
        getClassifier in class AbstractJarMojo
        Returns:
        get the classifier.
      • getType

        protected java.lang.String getType()
        Overload this to produce a test-jar, for example.
        Specified by:
        getType in class AbstractJarMojo
        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:
        getClassesDirectory in class AbstractJarMojo
        Returns:
        get classes directory.