Class JavadocJar

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
    Direct Known Subclasses:
    AggregatorJavadocJar, TestJavadocJar

    @Mojo(name="jar",
          defaultPhase=PACKAGE,
          requiresDependencyResolution=COMPILE,
          threadSafe=true)
    public class JavadocJar
    extends AbstractJavadocMojo
    Bundles the Javadoc documentation for main Java code in an NON aggregator project into a jar using the standard Javadoc Tool.
    Since:
    2.0
    • Field Detail

      • DEFAULT_INCLUDES

        private static final java.lang.String[] DEFAULT_INCLUDES
        Includes all generated Javadoc files
      • projectHelper

        @Component
        private org.apache.maven.project.MavenProjectHelper projectHelper
        Used for attaching the artifact in the project.
      • jarArchiver

        @Component(role=org.codehaus.plexus.archiver.Archiver.class,
                   hint="jar")
        private org.codehaus.plexus.archiver.jar.JarArchiver jarArchiver
        The Jar archiver.
        Since:
        2.5
      • destDir

        @Deprecated
        @Parameter(property="destDir")
        private java.io.File destDir
        Deprecated.
        Specifies the destination directory where javadoc saves the generated HTML files. See d.
      • jarOutputDirectory

        @Parameter(property="project.build.directory")
        private java.lang.String jarOutputDirectory
        Specifies the directory where the generated jar file will be put.
      • finalName

        @Parameter(property="project.build.finalName")
        private java.lang.String finalName
        Specifies the filename that will be used for the generated jar file. Please note that -javadoc or -test-javadoc will be appended to the file name.
      • attach

        @Parameter(property="attach",
                   defaultValue="true")
        private boolean attach
        Specifies whether to attach the generated artifact to the project helper.
      • archive

        @Parameter
        private org.apache.maven.archiver.MavenArchiveConfiguration archive
        The archive configuration to use. See Maven Archiver Reference.
        Since:
        2.5
      • defaultManifestFile

        @Parameter(defaultValue="${project.build.outputDirectory}/META-INF/MANIFEST.MF",
                   required=true,
                   readonly=true)
        private java.io.File defaultManifestFile
        Path to the default MANIFEST file to use. It will be used if useDefaultManifestFile is set to true.
        Since:
        2.5
      • useDefaultManifestFile

        @Parameter(defaultValue="false")
        private boolean useDefaultManifestFile
        Set this to true to enable the use of the defaultManifestFile.
        Since:
        2.5
      • classifier

        @Parameter(property="maven.javadoc.classifier",
                   defaultValue="javadoc",
                   required=true)
        private java.lang.String classifier
        Since:
        2.10
      • outputTimestamp

        @Parameter(defaultValue="${project.build.outputTimestamp}")
        private java.lang.String outputTimestamp
        Timestamp for reproducible output archive entries, either formatted as ISO 8601 yyyy-MM-dd'T'HH:mm:ssXXX or as an int representing seconds since the epoch (like SOURCE_DATE_EPOCH).
        Since:
        3.2.0
    • Constructor Detail

      • JavadocJar

        public JavadocJar()
    • Method Detail

      • doExecute

        public void doExecute()
                       throws org.apache.maven.plugin.MojoExecutionException
        Specified by:
        doExecute in class AbstractJavadocMojo
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • getClassifier

        protected java.lang.String getClassifier()
        Returns:
        the wanted classifier, i.e. javadoc or test-javadoc
      • generateArchive

        private java.io.File generateArchive​(java.io.File javadocFiles,
                                             java.lang.String jarFileName)
                                      throws org.codehaus.plexus.archiver.ArchiverException,
                                             java.io.IOException
        Method that creates the jar file
        Parameters:
        javadocFiles - the directory where the generated jar file will be put
        jarFileName - the filename of the generated jar file
        Returns:
        a File object that contains the generated jar file
        Throws:
        org.codehaus.plexus.archiver.ArchiverException - ArchiverException
        java.io.IOException - IOException