Class AbstractJavadocMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.maven.plugins.javadoc.AbstractJavadocMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
JavadocJarMojo, JavadocReport, ResourcesBundleMojo

public abstract class AbstractJavadocMojo extends org.apache.maven.plugin.AbstractMojo
Base class with the majority of Javadoc functionality.
Since:
2.0
See Also:
  • Field Details

    • JAVADOC_RESOURCES_ATTACHMENT_CLASSIFIER

      public static final String JAVADOC_RESOURCES_ATTACHMENT_CLASSIFIER
      Classifier used in the name of the javadoc-options XML file, and in the resources bundle artifact that gets attached to the project. This one is used for non-test javadocs.
      Since:
      2.7
      See Also:
    • TEST_JAVADOC_RESOURCES_ATTACHMENT_CLASSIFIER

      public static final String TEST_JAVADOC_RESOURCES_ATTACHMENT_CLASSIFIER
      Classifier used in the name of the javadoc-options XML file, and in the resources bundle artifact that gets attached to the project. This one is used for test-javadocs.
      Since:
      2.7
      See Also:
    • DEBUG_JAVADOC_SCRIPT_NAME

      protected static final String DEBUG_JAVADOC_SCRIPT_NAME
      The Javadoc script file name when debug parameter is on, i.e. javadoc.bat or javadoc.sh
    • OPTIONS_FILE_NAME

      protected static final String OPTIONS_FILE_NAME
      The options file name in the output directory when calling: javadoc.exe(or .sh) @options @packages | @argfile | @files
      See Also:
    • PACKAGES_FILE_NAME

      protected static final String PACKAGES_FILE_NAME
      The packages file name in the output directory when calling: javadoc.exe(or .sh) @options @packages | @argfile | @files
      See Also:
    • ARGFILE_FILE_NAME

      protected static final String ARGFILE_FILE_NAME
      The argfile file name in the output directory when calling: javadoc.exe(or .sh) @options @packages | @argfile | @files
      See Also:
    • FILES_FILE_NAME

      protected static final String FILES_FILE_NAME
      The files file name in the output directory when calling: javadoc.exe(or .sh) @options @packages | @argfile | @files
      See Also:
    • DEFAULT_CSS_NAME

      private static final String DEFAULT_CSS_NAME
      Default CSS file name, used as file name in the output directory for the temporary custom stylesheet file loaded from classloader resources.
      See Also:
    • PACKAGE_LIST

      private static final String PACKAGE_LIST
      See Also:
    • ELEMENT_LIST

      private static final String ELEMENT_LIST
      See Also:
    • SINCE_JAVADOC_1_8

      private static final org.codehaus.plexus.languages.java.version.JavaVersion SINCE_JAVADOC_1_8
      For Javadoc options appears since Java 8.0. See Javadoc Technology
      Since:
      3.0.0
    • JAVA_VERSION

      private static final org.codehaus.plexus.languages.java.version.JavaVersion JAVA_VERSION
    • siteTool

      protected org.apache.maven.doxia.tools.SiteTool siteTool
      SiteTool.
    • archiverManager

      private org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager
      Archiver manager
      Since:
      2.5
    • resourceResolver

      private ResourceResolver resourceResolver
    • repoSystem

      private org.eclipse.aether.RepositorySystem repoSystem
    • repoSession

      @Parameter(defaultValue="${repositorySystemSession}", readonly=true, required=true) private org.eclipse.aether.RepositorySystemSession repoSession
    • artifactHandlerManager

      private org.apache.maven.artifact.handler.manager.ArtifactHandlerManager artifactHandlerManager
    • mavenProjectBuilder

      private org.apache.maven.project.ProjectBuilder mavenProjectBuilder
      Project builder
      Since:
      3.0
    • toolchainManager

      private org.apache.maven.toolchain.ToolchainManager toolchainManager
    • locationManager

      final org.codehaus.plexus.languages.java.jpms.LocationManager locationManager
    • session

      @Parameter(defaultValue="${session}", readonly=true, required=true) protected org.apache.maven.execution.MavenSession session
      The current build session instance. This is used for toolchain manager API calls.
    • settings

      @Parameter(defaultValue="${settings}", readonly=true, required=true) private org.apache.maven.settings.Settings settings
      The Maven Settings.
      Since:
      2.3
    • project

      @Parameter(defaultValue="${project}", readonly=true, required=true) protected org.apache.maven.project.MavenProject project
      The Maven Project Object
    • mojoExecution

      @Parameter(defaultValue="${mojoExecution}", readonly=true, required=true) protected org.apache.maven.plugin.MojoExecution mojoExecution
    • offline

      @Parameter(property="maven.javadoc.offline", defaultValue="false") private boolean offline
      Specify if the Javadoc plugin should operate in offline mode. If maven is run in offline mode (using -o or --offline on the command line), this option has no effect and the plugin is always in offline mode.
      Since:
      3.6.0
    • javadocDirectory

      @Parameter(defaultValue="${basedir}/src/main/javadoc") private File javadocDirectory
      Specifies the Javadoc resources directory to be included in the Javadoc (i.e. package.html, images...).
      Could be used in addition of docfilessubdirs parameter.
      See docfilessubdirs.
      Since:
      2.1
      See Also:
    • additionalOptions

      @Parameter private String[] additionalOptions
      Set an additional option(s) on the command line. All input will be passed as-is to the @options file. You must take care of quoting and escaping. Useful for a custom doclet.
      Since:
      3.0.0
    • additionalJOption

      @Parameter(property="additionalJOption") private String additionalJOption
      Sets additional Javadoc options (e.g. JVM options) on the command line. Example:
       <additionalJOption>-J-Xss128m</additionalJOption>
       
      Since:
      2.3
      See Also:
    • additionalJOptions

      @Parameter private String[] additionalJOptions
      Sets additional Javadoc options for the execution of the javadoc command via the '-J' option to javadoc. Example:
           <additionalJOptions>
               <additionalJOption>-J-Xmx1g </additionalJOption>
           </additionalJOptions>
       
      Since:
      2.9
      See Also:
    • resourcesArtifacts

      @Parameter(property="resourcesArtifacts") private ResourcesArtifact[] resourcesArtifacts
      A list of artifacts containing resources which should be copied into the Javadoc output directory (like stylesheets, icons, etc.).
      Example:
       <resourcesArtifacts>
         <resourcesArtifact>
           <groupId>external.group.id</groupId>
           <artifactId>external-resources</artifactId>
           <version>1.0</version>
         </resourcesArtifact>
       </resourcesArtifacts>
       

      See Javadoc.
      Since:
      2.5
    • reactorProjects

      @Parameter(defaultValue="${reactorProjects}", required=true, readonly=true) protected List<org.apache.maven.project.MavenProject> reactorProjects
      The projects in the reactor for aggregation report.
    • debug

      @Parameter(property="debug", defaultValue="false") private boolean debug
      Set this to true to debug the Javadoc plugin. With this, javadoc.bat(or.sh), options, @packages or argfile files are provided in the output directory.
      Since:
      2.1
    • javadocExecutable

      @Parameter(property="javadocExecutable") private String javadocExecutable
      Sets the absolute path of the Javadoc Tool executable to use. Since version 2.5, a mere directory specification is sufficient to have the plugin use "javadoc" or "javadoc.exe" respectively from this directory.
      Since:
      2.3
    • javadocVersion

      @Parameter(property="javadocVersion") private String javadocVersion
      Version of the Javadoc Tool executable to use, ex. "1.3", "1.5".
      Since:
      2.3
    • javadocRuntimeVersion

      private org.codehaus.plexus.languages.java.version.JavaVersion javadocRuntimeVersion
      Version of the Javadoc Tool executable to use.
    • skip

      @Parameter(property="maven.javadoc.skip", defaultValue="false") protected boolean skip
      Specifies whether the Javadoc generation should be skipped.
      Since:
      2.5
    • failOnError

      @Parameter(property="maven.javadoc.failOnError", defaultValue="true") protected boolean failOnError
      Specifies if the build will fail if there are errors during javadoc execution or not.
      Since:
      2.5
    • failOnWarnings

      @Parameter(property="maven.javadoc.failOnWarnings", defaultValue="false") protected boolean failOnWarnings
      Specifies if the build will fail if there are warning during javadoc execution or not.
      Since:
      3.0.1
    • useStandardDocletOptions

      @Parameter(property="useStandardDocletOptions", defaultValue="true") protected boolean useStandardDocletOptions
      Specifies to use the options provided by the Standard Doclet for a custom doclet.
      Example:
       <docletArtifacts>
         <docletArtifact>
           <groupId>com.sun.tools.doclets</groupId>
           <artifactId>doccheck</artifactId>
           <version>1.2b2</version>
         </docletArtifact>
       </docletArtifacts>
       <useStandardDocletOptions>true</useStandardDocletOptions>
       
      Since:
      2.5
    • bootclasspath

      @Parameter(property="bootclasspath") private String bootclasspath
      Specifies the paths where the boot classes reside. The bootclasspath can contain multiple paths by separating them with a colon (:) or a semicolon (;).
      Since:
      2.5
      See Also:
    • bootclasspathArtifacts

      @Parameter(property="bootclasspathArtifacts") private BootclasspathArtifact[] bootclasspathArtifacts
      Specifies the artifacts where the boot classes reside.
      Example:
       <bootclasspathArtifacts>
         <bootclasspathArtifact>
           <groupId>my-groupId</groupId>
           <artifactId>my-artifactId</artifactId>
           <version>my-version</version>
         </bootclasspathArtifact>
       </bootclasspathArtifacts>
       

      See Javadoc.
      Since:
      2.5
      See Also:
    • breakiterator

      @Parameter(property="breakiterator", defaultValue="false") private boolean breakiterator
      Uses the sentence break iterator to determine the end of the first sentence.
      See Also:
    • doclet

      @Parameter(property="doclet") private String doclet
      Specifies the class file that starts the doclet used in generating the documentation.
      See Also:
    • docletArtifact

      @Parameter(property="docletArtifact") private DocletArtifact docletArtifact
      Specifies the artifact containing the doclet starting class file (specified with the doclet option).
      Example:
       <docletArtifact>
         <groupId>com.sun.tools.doclets</groupId>
         <artifactId>doccheck</artifactId>
         <version>1.2b2</version>
       </docletArtifact>
       

      See Javadoc.
      See Also:
    • docletArtifacts

      @Parameter(property="docletArtifacts") private DocletArtifact[] docletArtifacts
      Specifies multiple artifacts containing the path for the doclet starting class file (specified with the doclet option).
      Example:
       <docletArtifacts>
         <docletArtifact>
           <groupId>com.sun.tools.doclets</groupId>
           <artifactId>doccheck</artifactId>
           <version>1.2b2</version>
         </docletArtifact>
       </docletArtifacts>
       

      See Javadoc.
      Since:
      2.1
      See Also:
    • docletPath

      @Parameter(property="docletPath") private String docletPath
      Specifies the path to the doclet starting class file (specified with the doclet option) and any jar files it depends on. The docletPath can contain multiple paths by separating them with a colon (:) or a semicolon (;).
      See Also:
    • encoding

      @Parameter(property="encoding", defaultValue="${project.build.sourceEncoding}") private String encoding
      Specifies the encoding name of the source files. If not specified, the encoding value will be the value of the file.encoding system property.
      Note: In 2.4, the default value was locked to ISO-8859-1 to ensure reproducing build, but this was reverted in 2.5.
      See Also:
    • excludePackageNames

      @Parameter(property="excludePackageNames") private String excludePackageNames
      Unconditionally excludes the specified packages and their subpackages from the list formed by -subpackages. Multiple packages can be separated by commas (,), colons (:) or semicolons (;).

      Wildcards work as followed:

      • a wildcard at the beginning should match one or more directories
      • any other wildcard must match exactly one directory

      Example:
       <excludePackageNames>*.internal:org.acme.exclude1.*:org.acme.exclude2</excludePackageNames>
       
      See Also:
    • extdirs

      @Parameter(property="extdirs") private String extdirs
      Specifies the directories where extension classes reside. Separate directories in extdirs with a colon (:) or a semicolon (;).
      See Also:
    • locale

      @Parameter(property="locale") private String locale
      Specifies the locale that javadoc uses when generating documentation.
      See Also:
    • maxmemory

      @Parameter(property="maxmemory") private String maxmemory
      Specifies the maximum Java heap size to be used when launching the Javadoc tool. JVMs refer to this property as the -Xmx parameter. Example: '512' or '512m'. The memory unit depends on the JVM used. The units supported could be: k, kb, m, mb, g, gb, t, tb. If no unit specified, the default unit is m.
    • minmemory

      @Parameter(property="minmemory") private String minmemory
      Specifies the minimum Java heap size to be used when launching the Javadoc tool. JVMs refer to this property as the -Xms parameter. Example: '512' or '512m'. The memory unit depends on the JVM used. The units supported could be: k, kb, m, mb, g, gb, t, tb. If no unit specified, the default unit is m.
    • old

      @Parameter(property="old", defaultValue="false") @Deprecated private boolean old
      Deprecated.
      No longer used.
      This option creates documentation with the appearance and functionality of documentation generated by Javadoc 1.1. This is no longer supported since Javadoc 1.4 (shipped with JDK 1.4)
      See Also:
    • overview

      @Parameter(property="overview", defaultValue="${basedir}/src/main/javadoc/overview.html") private File overview
      Specifies that javadoc should retrieve the text for the overview documentation from the "source" file specified by path/filename and place it on the Overview page (overview-summary.html).
      Note: could be in conflict with nooverview.
      See Also:
    • quiet

      @Parameter(property="quiet", defaultValue="false") private boolean quiet
      Shuts off non-error and non-warning messages, leaving only the warnings and errors appear, making them easier to view.
      Note: was a standard doclet in Java 1.4.2 (refer to bug ID 4714350).
      Since Java 5.0.
      See Also:
    • show

      @Parameter(property="show", defaultValue="protected") private String show
      Specifies the access level for classes and members to show in the Javadocs. Possible values are:
      • public (shows only public classes and members)
      • protected (shows only public and protected classes and members)
      • package (shows all classes and members not marked private)
      • private (shows all classes and members)
      See Also:
    • source

      @Parameter(property="source", defaultValue="${maven.compiler.source}") private String source
      Provide source compatibility with specified release. Since JDK 9 rather use release.
      See Also:
    • release

      @Parameter(defaultValue="${maven.compiler.release}") private String release
      Provide source compatibility with specified release
      Since:
      JDK 9, 3.1.0
      See Also:
    • sourcepath

      @Parameter(property="sourcepath") private String sourcepath
      Specifies the source paths where the subpackages are located. The sourcepath can contain multiple paths by separating them with a colon (:) or a semicolon (;).
      See Also:
    • disableSourcepathUsage

      @Parameter(property="maven.javadoc.disableSourcepathUsage") private boolean disableSourcepathUsage
      When using legacyMode and aggregated javadoc, users may have a mix of Maven modules with module files and not. The javadoc need to be called with empty -sourcepath argument and files are in the argfile This usually need to be used with the following configuration
       
         <sourceFileExcludes>
           <sourceFileExclude>**\/module-info.java</sourceFileExclude>
         </sourceFileExcludes>
       
       
      Since:
      3.11.2
    • subpackages

      @Parameter(property="subpackages") private String subpackages
      Specifies the package directory where javadoc will be executed. Multiple packages can be separated by colons (:).
      See Also:
    • verbose

      @Parameter(property="verbose", defaultValue="false") private boolean verbose
      Provides more detailed messages while javadoc is running.
      See Also:
    • legacyMode

      @Parameter(property="legacyMode", defaultValue="false") private boolean legacyMode
      Run the javadoc tool in pre-Java 9 (non-modular) style even if the java version is post java 9. This allows non-JPMS projects that have moved to newer Java versions to create javadocs without having to use JPMS modules.
      Since:
      3.6.0
    • author

      @Parameter(property="author", defaultValue="true") private boolean author
      Specifies whether the author text is included in the generated Javadocs.
      See Also:
    • bottom

      @Parameter(property="bottom", defaultValue="Copyright &#169; {inceptionYear}&#x2013;{currentYear} {organizationName}. All rights reserved.") private String bottom
      Specifies the text to be placed at the bottom of each output file.
      If you want to use html, you have to put it in a CDATA section,
      e.g. <![CDATA[Copyright 2005, <a href="http://www.mycompany.com">MyCompany, Inc.<a>]]>
      Note:If the project has the property project.build.outputTimestamp, its year will be used as {currentYear}. This way it is possible to generate reproducible javadoc jars.
      See Also:
    • charset

      @Parameter(property="charset") private String charset
      Specifies the HTML character set for this document. If not specified, the charset value will be the value of the docencoding parameter.
      See Also:
    • docencoding

      @Parameter(property="docencoding", defaultValue="${project.reporting.outputEncoding}") private String docencoding
      Specifies the encoding of the generated HTML files. If not specified, the docencoding value will be UTF-8.
      See Also:
    • docfilessubdirs

      @Parameter(property="docfilessubdirs", defaultValue="false") private boolean docfilessubdirs
      Enables deep copying of the **/doc-files directories and the specific resources directory from the javadocDirectory directory (for instance, src/main/javadoc/com/mycompany/myapp/doc-files and src/main/javadoc/resources).
      See Also:
    • doclint

      @Parameter(property="doclint") private String doclint
      Specifies specific checks to be performed on Javadoc comments.
      Since:
      3.0.0
      See Also:
    • doctitle

      @Parameter(property="doctitle", defaultValue="${project.name} ${project.version} API") private String doctitle
      Specifies the title to be placed near the top of the overview summary file.
      See Also:
    • excludedocfilessubdir

      @Parameter(property="excludedocfilessubdir") private String excludedocfilessubdir
      Excludes any "doc-files" subdirectories with the given names. Multiple patterns can be excluded by separating them with colons (:).
      See Also:
    • groups

      @Parameter private Group[] groups
      Separates packages on the overview page into whatever groups you specify, one group per table. The packages pattern can be any package name, or can be the start of any package name followed by an asterisk (*) meaning "match any characters". Multiple patterns can be included in a group by separating them with colons (:).
      Example:
       <groups>
         <group>
           <title>Core Packages</title>
           <!-- To includes java.lang, java.lang.ref,
           java.lang.reflect and only java.util
           (i.e. not java.util.jar) -->
           <packages>java.lang*:java.util</packages>
         </group>
         <group>
           <title>Extension Packages</title>
            <!-- To include javax.accessibility,
           javax.crypto, ... (among others) -->
           <packages>javax.*</packages>
         </group>
       </groups>
       
      Note: using java.lang.* for packages would omit the java.lang package but using java.lang* will include it.
      See Also:
    • helpfile

      @Parameter(property="helpfile") private String helpfile
      Specifies the path of an alternate help file path\filename that the HELP link in the top and bottom navigation bars link to.
      Note: could be in conflict with <nohelp/>.
      The helpfile could be an absolute File path.
      Since 2.6, it could be also be a path from a resource in the current project source directories (i.e. src/main/java, src/main/resources or src/main/javadoc) or from a resource in the Javadoc plugin dependencies, for instance:
       <helpfile>path/to/your/resource/yourhelp-doc.html</helpfile>
       
      Where path/to/your/resource/yourhelp-doc.html could be in src/main/javadoc.
       <build>
         <plugins>
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-javadoc-plugin</artifactId>
             <configuration>
               <helpfile>path/to/your/resource/yourhelp-doc.html</helpfile>
               ...
             </configuration>
             <dependencies>
               <dependency>
                 <groupId>groupId</groupId>
                 <artifactId>artifactId</artifactId>
                 <version>version</version>
               </dependency>
             </dependencies>
           </plugin>
           ...
         <plugins>
       </build>
       
      Where path/to/your/resource/yourhelp-doc.html is defined in the groupId:artifactId:version javadoc plugin dependency.
      See Also:
    • keywords

      @Parameter(property="keywords", defaultValue="false") private boolean keywords
      Adds HTML meta keyword tags to the generated file for each class.
      Since:
      2.1
      See Also:
    • linksource

      @Parameter(property="linksource", defaultValue="false") private boolean linksource
      Creates an HTML version of each source file (with line numbers) and adds links to them from the standard HTML documentation.
      See Also:
    • nocomment

      @Parameter(property="nocomment", defaultValue="false") private boolean nocomment
      Suppress the entire comment body, including the main description and all tags, generating only declarations.
      See Also:
    • nodeprecated

      @Parameter(property="nodeprecated", defaultValue="false") private boolean nodeprecated
      Prevents the generation of any deprecated API at all in the documentation.
      See Also:
    • nodeprecatedlist

      @Parameter(property="nodeprecatedlist", defaultValue="false") private boolean nodeprecatedlist
      Prevents the generation of the file containing the list of deprecated APIs (deprecated-list.html) and the link in the navigation bar to that page.
      See Also:
    • nohelp

      @Parameter(property="nohelp", defaultValue="false") private boolean nohelp
      Omits the HELP link in the navigation bars at the top and bottom of each page of output.
      Note: could be in conflict with helpfile.
      See Also:
    • noindex

      @Parameter(property="noindex", defaultValue="false") private boolean noindex
      Omits the index from the generated docs.
      Note: could be in conflict with splitindex
      See Also:
    • nonavbar

      @Parameter(property="nonavbar", defaultValue="false") private boolean nonavbar
      Omits the navigation bar from the generated docs.
      See Also:
    • nooverview

      @Parameter(property="nooverview", defaultValue="false") private boolean nooverview
      Omits the entire overview page from the generated docs.
      Note: could be in conflict with overview.
      Standard Doclet undocumented option.
      Since:
      2.4
    • noqualifier

      @Parameter(property="noqualifier") private String noqualifier
      Omits qualifying package name from ahead of class names in output. Example:
       <noqualifier>all</noqualifier>
       or
       <noqualifier>packagename1:packagename2</noqualifier>
       
      See Also:
    • nosince

      @Parameter(property="nosince", defaultValue="false") private boolean nosince
      Omits the "Since" sections from the generated docs.
      See Also:
    • notimestamp

      @Parameter(property="notimestamp", defaultValue="false") private boolean notimestamp
      Suppresses the timestamp, which is hidden in an HTML comment in the generated HTML near the top of each page.

      Note: If the project has the property project.build.outputTimestamp, the value will be overwritten to true. This way it is possible to generate reproducible javadoc jars.
      Since:
      2.1
      See Also:
    • notree

      @Parameter(property="notree", defaultValue="false") private boolean notree
      Omits the class/interface hierarchy pages from the generated docs.
      See Also:
    • outputDirectory

      @Parameter(defaultValue="${project.build.directory}/reports", required=true) protected File outputDirectory
      The shared output directory for the report where Javadoc saves the generated HTML files. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the shared output directory configured in the Maven Site Plugin is used instead.
      See Also:
    • packagesheader

      @Parameter(property="packagesheader") private String packagesheader
      Specify the text for upper left frame.
      Since:
      2.1
      See Also:
    • serialwarn

      @Parameter(property="serialwarn", defaultValue="false") private boolean serialwarn
      Generates compile-time warnings for missing serial tags.
      See Also:
    • sourcetab

      @Parameter(property="sourcetab", alias="linksourcetab") private int sourcetab
      Specify the number of spaces each tab takes up in the source. If no tab is used in source, the default space is used.
      Since:
      2.1
      See Also:
    • splitindex

      @Parameter(property="splitindex", defaultValue="false") private boolean splitindex
      Splits the index file into multiple files, alphabetically, one file per letter, plus a file for any index entries that start with non-alphabetical characters.
      Note: could be in conflict with noindex.
      See Also:
    • stylesheet

      @Parameter(property="stylesheet", defaultValue="java") @Deprecated private String stylesheet
      Deprecated.
      This is no longer evaluated, instead use addStylesheets to customize the CSS.
      Specifies whether the stylesheet to be used is the maven's javadoc stylesheet or java's default stylesheet when a stylesheetfile parameter is not specified.
      Possible values: maven or java.
    • stylesheetfile

      @Parameter(property="stylesheetfile") private String stylesheetfile
      Specifies the path of an alternate HTML stylesheet file.
      The stylesheetfile could be an absolute File path.
      Since 2.6, it could be also be a path from a resource in the current project source directories (i.e. src/main/java, src/main/resources or src/main/javadoc) or from a resource in the Javadoc plugin dependencies, for instance:
       <stylesheetfile>path/to/your/resource/yourstylesheet.css</stylesheetfile>
       
      Where path/to/your/resource/yourstylesheet.css could be in src/main/javadoc.
       <build>
         <plugins>
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-javadoc-plugin</artifactId>
             <configuration>
               <stylesheetfile>path/to/your/resource/yourstylesheet.css</stylesheetfile>
               ...
             </configuration>
             <dependencies>
               <dependency>
                 <groupId>groupId</groupId>
                 <artifactId>artifactId</artifactId>
                 <version>version</version>
               </dependency>
             </dependencies>
           </plugin>
           ...
         <plugins>
       </build>
       
      Where path/to/your/resource/yourstylesheet.css is defined in the groupId:artifactId:version javadoc plugin dependency.
      See Also:
    • addStylesheets

      @Parameter private String[] addStylesheets
      Specifies the path of an additional HTML stylesheet file relative to the javadocDirectory Example:
           <addStylesheets>
               <addStylesheet>resources/addstylesheet.css</addStylesheet>
           </addStylesheets>
       
      Since:
      3.3.0
    • taglet

      @Parameter(property="taglet") private String taglet
      Specifies the class file that starts the taglet used in generating the documentation for that tag.
      See Also:
    • tagletArtifact

      @Parameter(property="tagletArtifact") private TagletArtifact tagletArtifact
      Specifies the Taglet artifact containing the taglet class files (.class).
      Example:
       <taglets>
         <taglet>
           <tagletClass>com.sun.tools.doclets.ToDoTaglet</tagletClass>
         </taglet>
         <taglet>
           <tagletClass>package.to.AnotherTagletClass</tagletClass>
         </taglet>
         ...
       </taglets>
       <tagletArtifact>
         <groupId>group-Taglet</groupId>
         <artifactId>artifact-Taglet</artifactId>
         <version>version-Taglet</version>
       </tagletArtifact>
       

      See Javadoc.
      Since:
      2.1
      See Also:
    • tagletArtifacts

      @Parameter(property="tagletArtifacts") private TagletArtifact[] tagletArtifacts
      Specifies several Taglet artifacts containing the taglet class files (.class). These taglet class names will be auto-detected and so no need to specify them.
      Example:
       <tagletArtifacts>
         <tagletArtifact>
           <groupId>group-Taglet</groupId>
           <artifactId>artifact-Taglet</artifactId>
           <version>version-Taglet</version>
         </tagletArtifact>
         ...
       </tagletArtifacts>
       

      See Javadoc.
      Since:
      2.5
      See Also:
    • tagletpath

      @Parameter(property="tagletpath") private String tagletpath
      Specifies the search paths for finding taglet class files (.class). The tagletpath can contain multiple paths by separating them with a colon (:) or a semicolon (;).
      See Also:
    • taglets

      @Parameter(property="taglets") private Taglet[] taglets
      Enables the Javadoc tool to interpret multiple taglets.
      Example:
       <taglets>
         <taglet>
           <tagletClass>com.sun.tools.doclets.ToDoTaglet</tagletClass>
           <!--<tagletpath>/home/taglets</tagletpath>-->
           <tagletArtifact>
             <groupId>group-Taglet</groupId>
             <artifactId>artifact-Taglet</artifactId>
             <version>version-Taglet</version>
           </tagletArtifact>
         </taglet>
       </taglets>
       

      See Javadoc.
      Since:
      2.1
      See Also:
    • tags

      @Parameter(property="tags") private Tag[] tags
      Enables the Javadoc tool to interpret a simple, one-argument custom block tag tagname in doc comments.
      Example:
       <tags>
         <tag>
           <name>todo</name>
           <placement>a</placement>
           <head>To Do:</head>
         </tag>
       </tags>
       
      Note: the placement should be a combinaison of Xaoptcmf letters:
      • X (disable tag)
      • a (all)
      • o (overview)
      • p (packages)
      • t (types, that is classes and interfaces)
      • c (constructors)
      • m (methods)
      • f (fields)
      See Javadoc.
      See Also:
    • top

      @Parameter(property="top") private String top
      Specifies the top text to be placed at the top of each output file.
      Since:
      2.4
      See Also:
    • use

      @Parameter(property="use", defaultValue="true") private boolean use
      Includes one "Use" page for each documented class and package.
      See Also:
    • version

      @Parameter(property="version", defaultValue="true") private boolean version
      Includes the given version text in the generated docs.
      See Also:
    • windowtitle

      @Parameter(property="windowtitle", defaultValue="${project.name} ${project.version} API") private String windowtitle
      Specifies the title to be placed in the HTML title tag.
      See Also:
    • includeDependencySources

      @Parameter(defaultValue="false") private boolean includeDependencySources
      Whether dependency -sources jars should be resolved and included as source paths for javadoc generation. This is useful when creating javadocs for a distribution project.
      Since:
      2.7
    • sourceDependencyCacheDir

      @Parameter(defaultValue="${project.build.directory}/distro-javadoc-sources") private File sourceDependencyCacheDir
      Directory where unpacked project sources / test-sources should be cached.
      Since:
      2.7
      See Also:
    • includeTransitiveDependencySources

      @Parameter(defaultValue="false") @Deprecated private boolean includeTransitiveDependencySources
      Deprecated.
      if these sources depend on transitive dependencies, those dependencies should be added to the pom as direct dependencies
      Whether to include transitive dependencies in the list of dependency -sources jars to include in this javadoc run.
      Since:
      2.7
      See Also:
    • dependencySourceIncludes

      @Parameter private List<String> dependencySourceIncludes
      List of included dependency-source patterns. Example: org.apache.maven:*
      Since:
      2.7
      See Also:
    • dependencySourceExcludes

      @Parameter private List<String> dependencySourceExcludes
      List of excluded dependency-source patterns. Example: org.apache.maven.shared:*
      Since:
      2.7
      See Also:
    • javadocOptionsDir

      @Parameter(defaultValue="${project.build.directory}/javadoc-bundle-options", readonly=true) private File javadocOptionsDir
      Directory into which assembled JavadocOptions instances will be written before they are added to javadoc resources bundles.
      Since:
      2.7
    • dependencyJavadocBundles

      private transient List<JavadocBundle> dependencyJavadocBundles
      Transient variable to allow lazy-resolution of javadoc bundles from dependencies, so they can be used at various points in the javadoc generation process.
      Since:
      2.7
    • additionalDependencies

      @Parameter private List<AdditionalDependency> additionalDependencies
      Capability to add additional dependencies to the javadoc classpath. Example:
       <additionalDependencies>
         <additionalDependency>
           <groupId>geronimo-spec</groupId>
           <artifactId>geronimo-spec-jta</artifactId>
           <version>1.0.1B-rc4</version>
         </additionalDependency>
       </additionalDependencies>
       
      Since:
      2.8.1
    • sourceFileIncludes

      @Parameter private List<String> sourceFileIncludes
      Include filters on the source files. Default is **\/\*.java. These are ignored if you specify subpackages or subpackage excludes.
      Since:
      2.9
    • sourceFileExcludes

      @Parameter private List<String> sourceFileExcludes
      exclude filters on the source files. These are ignored if you specify subpackages or subpackage excludes.
      Since:
      2.9
    • applyJavadocSecurityFix

      @Deprecated @Parameter(defaultValue="true", property="maven.javadoc.applyJavadocSecurityFix") private boolean applyJavadocSecurityFix
      Deprecated.
      the security fix this applied is not needed in Java 8+ or the most recent versions of JDK 6 and 7.
      No-op.
      Since:
      2.9.1
    • jdkToolchain

      @Parameter private Map<String,String> jdkToolchain

      Allow for configuration of the javadoc tool via maven toolchains. This overrules the toolchain selected by the maven-toolchain-plugin.

      Examples:

      (see Guide to Toolchains for more info)
       
          <configuration>
              ...
              <jdkToolchain>
                  <version>11</version>
              </jdkToolchain>
          </configuration>
      
          <configuration>
              ...
              <jdkToolchain>
                  <version>1.8</version>
                  <vendor>zulu</vendor>
              </jdkToolchain>
          </configuration>
          
       
      note: requires at least Maven 3.3.1
      Since:
      3.0.0
    • staleDataPath

      @Parameter(property="staleDataPath", defaultValue="${project.build.directory}/maven-javadoc-plugin-stale-data.txt") private File staleDataPath

      Location of the file used to store the state of the previous javadoc run. This is used to skip the generation if nothing has changed.

      Since:
      3.2.0
    • skippedModules

      @Parameter(property="maven.javadoc.skippedModules") private String skippedModules

      Comma separated list of modules (can be regular expression) in the format ([group:]artifactId) to not add in aggregated javadoc

      Since:
      3.2.0
    • patternsToSkip

      private List<Pattern> patternsToSkip
      List built once from the parameter skippedModules
    • outputTimestamp

      @Parameter(defaultValue="${project.build.outputTimestamp}") protected 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
    • forceRootLocale

      @Parameter(property="forceRootLocale", defaultValue="true") private boolean forceRootLocale
      Forces the Javadoc JVM locale to be Locale.ROOT. This will force the Javadoc output on stdout and stderr to be in English only and the generated HTML content in English as well. If you need the generated HTML content in another supported language use locale.
      Since:
      3.8.0
    • disableNoFonts

      @Parameter(property="maven.javadoc.disableNoFonts", defaultValue="false") private boolean disableNoFonts
      From jdk 23, javadoc now include some extra css, files which can increase the size of javadoc jar. This can be disabled using the option --no-fonts The javadoc plugin will add this option to disable extra files to be added per default. If you prefer the new font you must set to true the option disableNoFonts
      Since:
      3.11.3
  • Constructor Details

    • AbstractJavadocMojo

      public AbstractJavadocMojo(org.apache.maven.doxia.tools.SiteTool siteTool, org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager, ResourceResolver resourceResolver, org.eclipse.aether.RepositorySystem repoSystem, org.apache.maven.artifact.handler.manager.ArtifactHandlerManager artifactHandlerManager, org.apache.maven.project.ProjectBuilder mavenProjectBuilder, org.apache.maven.toolchain.ToolchainManager toolchainManager)
  • Method Details

    • isAggregator

      protected boolean isAggregator()
      Indicates whether this goal is flagged with @aggregator.
      Returns:
      true if the goal is designed as an aggregator, false otherwise.
      See Also:
    • isTest

      protected boolean isTest()
      Indicates whether this goal generates documentation for the Java Test code.
      Returns:
      true if the goal generates Test Javadocs, false otherwise.
    • getOutputDirectory

      protected String getOutputDirectory()
    • getPluginReportOutputDirectory

      protected String getPluginReportOutputDirectory()
      Method that returns the plugin report output directory where the generated Javadoc report will be put beneath getOutputDirectory()/AbstractMavenReport.getReportOutputDirectory().
      Returns:
      a String that contains the target directory
    • getProject

      protected org.apache.maven.project.MavenProject getProject()
    • getProjectBuildOutputDirs

      protected List<File> getProjectBuildOutputDirs(org.apache.maven.project.MavenProject p)
      Parameters:
      p - not null maven project
      Returns:
      the list of directories where compiled classes are placed for the given project. These dirs are added to the javadoc classpath.
    • getClassesFile

      protected File getClassesFile(org.apache.maven.project.MavenProject project)
      Parameters:
      project - the project in which to find a classes file
      Returns:
      null, the attached artifact file, or outputDirectory.
    • getProjectSourceRoots

      protected List<String> getProjectSourceRoots(org.apache.maven.project.MavenProject p)
      Parameters:
      p - not null maven project
      Returns:
      the list of source paths for the given project
    • getExecutionProjectSourceRoots

      protected List<String> getExecutionProjectSourceRoots(org.apache.maven.project.MavenProject p)
      Parameters:
      p - not null maven project
      Returns:
      the list of source paths for the execution project of the given project
    • getJavadocDirectory

      protected File getJavadocDirectory()
      Returns:
      the current javadoc directory
    • getDoclint

      protected String getDoclint()
      Returns:
      the doclint specific checks configuration
    • getDoctitle

      protected String getDoctitle()
      Returns:
      the title to be placed near the top of the overview summary file
    • getOverview

      protected File getOverview()
      Returns:
      the overview documentation file from the user parameter or from the javadocdirectory
    • getWindowtitle

      protected String getWindowtitle()
      Returns:
      the title to be placed in the HTML title tag
    • getCharset

      private String getCharset()
      Returns:
      the charset attribute or the value of getDocencoding() if null.
    • getDocencoding

      private String getDocencoding()
      Returns:
      the docencoding attribute or UTF-8 if null.
    • getEncoding

      private String getEncoding()
      Returns:
      the encoding attribute or the value of file.encoding system property if null.
    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
      org.apache.maven.plugin.MojoFailureException
    • doExecute

      protected abstract void doExecute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
      org.apache.maven.plugin.MojoFailureException
    • verifyRemovedParameter

      protected final void verifyRemovedParameter(String paramName)
    • verifyReplacedParameter

      private void verifyReplacedParameter(String oldParamName, String newParamNew)
    • executeReport

      protected void executeReport(Locale unusedLocale) throws org.apache.maven.reporting.MavenReportException
      The package documentation details the Javadoc Options used by this Plugin.
      Parameters:
      unusedLocale - the wanted locale (actually unused).
      Throws:
      org.apache.maven.reporting.MavenReportException - if any
    • getFiles

      protected Map<Path,Collection<String>> getFiles(Collection<Path> sourcePaths) throws org.apache.maven.reporting.MavenReportException
      Method to get the files on the specified source paths
      Parameters:
      sourcePaths - a Collection that contains the paths to the source files
      Returns:
      a List that contains the specific path for every source file
      Throws:
      org.apache.maven.reporting.MavenReportException - MavenReportException issue while generating report
    • getSourcePaths

      protected Collection<JavadocModule> getSourcePaths() throws org.apache.maven.reporting.MavenReportException
      Method to get the source paths per reactorProject. If no source path is specified in the parameter, the compile source roots of the project will be used.
      Returns:
      a Map of the project absolute source paths per projects key (G:A)
      Throws:
      org.apache.maven.reporting.MavenReportException - MavenReportException issue while generating report
      See Also:
    • buildJavadocModule

      private JavadocModule buildJavadocModule(org.apache.maven.project.MavenProject project, Collection<Path> sourcePaths)
    • modulesForAggregatedProject

      private Set<org.apache.maven.project.MavenProject> modulesForAggregatedProject(org.apache.maven.project.MavenProject aggregatedProject, Map<Path,org.apache.maven.project.MavenProject> reactorProjectsMap)
      Recursively add the modules of the aggregatedProject to the set of aggregatedModules.
      Parameters:
      aggregatedProject - the project being aggregated
      reactorProjectsMap - map of (still) available reactor projects
    • configureDependencySourceResolution

      protected SourceResolverConfig configureDependencySourceResolution(SourceResolverConfig config)
      Override this method to customize the configuration for resolving dependency sources. The default behavior enables the resolution of -sources jar files.
      Parameters:
      config - SourceResolverConfig
      Returns:
      SourceResolverConfig
    • getDependencySourcePaths

      protected final Collection<JavadocModule> getDependencySourcePaths() throws org.apache.maven.reporting.MavenReportException
      Resolve dependency sources so they can be included directly in the javadoc process. To customize this, override configureDependencySourceResolution(SourceResolverConfig).
      Returns:
      List of source paths.
      Throws:
      org.apache.maven.reporting.MavenReportException - MavenReportException
    • createDependencyArtifactFilter

      private org.apache.maven.shared.artifact.filter.resolve.TransformableFilter createDependencyArtifactFilter()
      Returns an ArtifactFilter that only includes direct dependencies of this project (verified via groupId and artifactId).
    • getDependencySourceResolverConfig

      private SourceResolverConfig getDependencySourceResolverConfig()
      Construct a SourceResolverConfig for resolving dependency sources and resources in a consistent way, so it can be reused for both source and resource resolution.
      Since:
      2.7
    • getProjectBuildingRequest

      private org.apache.maven.project.ProjectBuildingRequest getProjectBuildingRequest(org.apache.maven.project.MavenProject currentProject)
    • canGenerateReport

      protected boolean canGenerateReport(Map<Path,Collection<String>> files)
      Method that indicates whether the javadoc can be generated or not. If the project does not contain any source files and no subpackages are specified, the plugin will terminate.
      Parameters:
      files - the project files
      Returns:
      a boolean that indicates whether javadoc report can be generated or not
    • getExcludedPackages

      private String getExcludedPackages(Collection<Path> sourcePaths) throws org.apache.maven.reporting.MavenReportException
      Method to get the excluded source files from the javadoc and create the argument string that will be included in the javadoc commandline execution.
      Parameters:
      sourcePaths - the collection of paths to the source files
      Returns:
      a String that contains the exclude argument that will be used by javadoc
      Throws:
      org.apache.maven.reporting.MavenReportException
    • getSourcePath

      private String getSourcePath(Collection<Path> sourcePaths)
      Method to format the specified source paths that will be accepted by the javadoc tool.
      Parameters:
      sourcePaths - the list of paths to the source files that will be included in the javadoc.
      Returns:
      a String that contains the formatted source path argument, separated by the System pathSeparator string (colon (:) on Solaris or semicolon (;) on Windows).
      See Also:
    • getExcludedPackages

      private Collection<String> getExcludedPackages() throws org.apache.maven.reporting.MavenReportException
      Method to get the packages specified in the excludePackageNames parameter. The packages are split with ',', ':', or ';' and then formatted.
      Returns:
      an array of String objects that contain the package names
      Throws:
      org.apache.maven.reporting.MavenReportException
    • trimValues

      private static List<String> trimValues(List<String> items)
    • toResolverDependencies

      private List<org.eclipse.aether.graph.Dependency> toResolverDependencies(List<org.apache.maven.model.Dependency> dependencies)
    • getPathElements

      private Collection<File> getPathElements() throws org.apache.maven.reporting.MavenReportException
      Method that gets the classpath and modulepath elements that will be specified in the javadoc -classpath and --module-path parameter. Since we have all the sources of the current reactor, it is sufficient to consider the dependencies of the reactor modules, excluding the module artifacts which may not yet be available when the reactor project is built for the first time.
      Returns:
      all classpath elements
      Throws:
      org.apache.maven.reporting.MavenReportException - if any.
    • getDependencyScopeFilter

      protected org.eclipse.aether.util.filter.ScopeDependencyFilter getDependencyScopeFilter()
    • resolveDependency

      public org.apache.maven.artifact.Artifact resolveDependency(org.apache.maven.model.Dependency dependency) throws org.apache.maven.reporting.MavenReportException
      Parameters:
      dependency - Dependency
      Returns:
      Artifact
      Throws:
      org.apache.maven.reporting.MavenReportException - when artifact could not be resolved
    • getToolchain

      protected final org.apache.maven.toolchain.Toolchain getToolchain()
    • populateCompileArtifactMap

      private void populateCompileArtifactMap(Map<String,org.apache.maven.artifact.Artifact> compileArtifactMap, Collection<org.apache.maven.artifact.Artifact> artifactList) throws org.apache.maven.reporting.MavenReportException
      Method to put the artifacts in the hashmap.
      Parameters:
      compileArtifactMap - the hashmap that will contain the artifacts
      artifactList - the list of artifacts that will be put in the map
      Throws:
      org.apache.maven.reporting.MavenReportException - if any
    • getBottomText

      private String getBottomText()
      Method that sets the text that will be displayed on the bottom of the javadocs.
      Returns:
      a String that contains the text that will be displayed at the bottom of the javadoc
    • getStylesheetFile

      private Optional<File> getStylesheetFile(File javadocOutputDirectory)
      Method to get the stylesheet path file to be used by the Javadoc Tool.
      If the stylesheetfile is empty, return the file as String defined by stylesheet value.
      If the stylesheetfile is defined, return the file as String.
      Note: since 2.6, the stylesheetfile could be a path from a resource in the project source directories (i.e. src/main/java, src/main/resources or src/main/javadoc) or from a resource in the Javadoc plugin dependencies.
      Parameters:
      javadocOutputDirectory - the output directory
      Returns:
      the stylesheet file absolute path as String.
      See Also:
    • addAddStyleSheets

      private void addAddStyleSheets(List<String> arguments) throws org.apache.maven.reporting.MavenReportException
      Throws:
      org.apache.maven.reporting.MavenReportException
    • getAddStylesheet

      private Optional<File> getAddStylesheet(File javadocOutputDirectory, String stylesheet) throws org.apache.maven.reporting.MavenReportException
      Throws:
      org.apache.maven.reporting.MavenReportException
    • getHelpFile

      private Optional<File> getHelpFile(File javadocOutputDirectory)
      Method to get the help file to be used by the Javadoc Tool.
      Since 2.6, the helpfile could be a path from a resource in the project source directories (i.e. src/main/java, src/main/resources or src/main/javadoc) or from a resource in the Javadoc plugin dependencies.
      Parameters:
      javadocOutputDirectory - the output directory.
      Returns:
      the help file absolute path as String.
      Since:
      2.6
      See Also:
    • getAccessLevel

      private String getAccessLevel()
      Method to get the access level for the classes and members to be shown in the generated javadoc. If the specified access level is not public, protected, package or private, the access level is set to protected.
      Returns:
      the access level
    • getBootclassPath

      private String getBootclassPath() throws org.apache.maven.reporting.MavenReportException
      Method to get the path of the bootclass artifacts used in the -bootclasspath option.
      Returns:
      a string that contains bootclass path, separated by the System pathSeparator string (colon (:) on Solaris or semicolon (;) on Windows).
      Throws:
      org.apache.maven.reporting.MavenReportException - if any
      See Also:
    • getDocletPath

      private String getDocletPath() throws org.apache.maven.reporting.MavenReportException
      Method to get the path of the doclet artifacts used in the -docletpath option.

      Either docletArtifact or doclectArtifacts can be defined and used, not both, docletArtifact takes precedence over doclectArtifacts. docletPath is always appended to any result path definition.

      Returns:
      a string that contains doclet path, separated by the System pathSeparator string (colon (:) on Solaris or semicolon (;) on Windows).
      Throws:
      org.apache.maven.reporting.MavenReportException - if any
      See Also:
    • isDocletArtifactEmpty

      private boolean isDocletArtifactEmpty(DocletArtifact aDocletArtifact)
      Verify if a doclet artifact is empty or not
      Parameters:
      aDocletArtifact - could be null
      Returns:
      true if aDocletArtifact or the groupId/artifactId/version of the doclet artifact is null, false otherwise.
    • getTagletPath

      private String getTagletPath() throws org.apache.maven.reporting.MavenReportException
      Method to get the path of the taglet artifacts used in the -tagletpath option.
      Returns:
      a string that contains taglet path, separated by the System pathSeparator string (colon (:) on Solaris or semicolon (;) on Windows).
      Throws:
      org.apache.maven.reporting.MavenReportException - if any
      See Also:
    • collectLinks

      private Set<String> collectLinks() throws org.apache.maven.reporting.MavenReportException
      Throws:
      org.apache.maven.reporting.MavenReportException
    • collectGroups

      private Set<Group> collectGroups() throws org.apache.maven.reporting.MavenReportException
      Throws:
      org.apache.maven.reporting.MavenReportException
    • collectResourcesArtifacts

      private Set<ResourcesArtifact> collectResourcesArtifacts() throws org.apache.maven.reporting.MavenReportException
      Throws:
      org.apache.maven.reporting.MavenReportException
    • collectBootClasspathArtifacts

      private Set<BootclasspathArtifact> collectBootClasspathArtifacts() throws org.apache.maven.reporting.MavenReportException
      Throws:
      org.apache.maven.reporting.MavenReportException
    • collectOfflineLinks

      private Set<OfflineLink> collectOfflineLinks() throws org.apache.maven.reporting.MavenReportException
      Throws:
      org.apache.maven.reporting.MavenReportException
    • collectTags

      private Set<Tag> collectTags() throws org.apache.maven.reporting.MavenReportException
      Throws:
      org.apache.maven.reporting.MavenReportException
    • collectTagletArtifacts

      private Set<TagletArtifact> collectTagletArtifacts() throws org.apache.maven.reporting.MavenReportException
      Throws:
      org.apache.maven.reporting.MavenReportException
    • collectDocletArtifacts

      private Set<DocletArtifact> collectDocletArtifacts() throws org.apache.maven.reporting.MavenReportException
      Throws:
      org.apache.maven.reporting.MavenReportException
    • collectTaglets

      private Set<Taglet> collectTaglets() throws org.apache.maven.reporting.MavenReportException
      Throws:
      org.apache.maven.reporting.MavenReportException
    • getArtifactsAbsolutePath

      private List<String> getArtifactsAbsolutePath(JavadocPathArtifact javadocArtifact) throws org.apache.maven.reporting.MavenReportException
      Return the Javadoc artifact path and its transitive dependencies path from the local repository
      Parameters:
      javadocArtifact - not null
      Returns:
      a list of locale artifacts absolute path
      Throws:
      org.apache.maven.reporting.MavenReportException - if any
    • createAndResolveArtifact

      private org.apache.maven.artifact.Artifact createAndResolveArtifact(JavadocPathArtifact javadocArtifact) throws org.eclipse.aether.resolution.ArtifactResolutionException
      Creates an Artifact representing the configured JavadocPathArtifact and resolves it.
      Parameters:
      javadocArtifact - the JavadocPathArtifact to resolve
      Returns:
      a resolved Artifact
      Throws:
      org.eclipse.aether.resolution.ArtifactResolutionException - issue while resolving artifact
    • addMemoryArg

      private void addMemoryArg(org.codehaus.plexus.util.cli.Commandline cmd, String arg, String memory)
      Method that adds/sets the java memory parameters in the command line execution.
      Parameters:
      cmd - the command line execution object where the argument will be added
      arg - the argument parameter name
      memory - the JVM memory value to be set
      See Also:
    • addProxyArg

      private void addProxyArg(org.codehaus.plexus.util.cli.Commandline cmd)
      Method that adds/sets the javadoc proxy parameters in the command line execution.
      Parameters:
      cmd - the command line execution object where the argument will be added
    • getJavadocExecutable

      private String getJavadocExecutable() throws IOException
      Get the path of the Javadoc tool executable depending on the user entry or try to find it depending on the OS or the java.home system property or the JAVA_HOME environment variable.
      Returns:
      the path of the Javadoc tool
      Throws:
      IOException - if not found
    • setFJavadocVersion

      private void setFJavadocVersion(File jExecutable) throws org.apache.maven.reporting.MavenReportException
      Set a new value for javadocRuntimeVersion
      Parameters:
      jExecutable - not null
      Throws:
      org.apache.maven.reporting.MavenReportException - if not found
      See Also:
    • isJavaDocVersionAtLeast

      private boolean isJavaDocVersionAtLeast(org.codehaus.plexus.languages.java.version.JavaVersion requiredVersion)
      Is the Javadoc version at least the requested version.
      Parameters:
      requiredVersion - the required version, for example 1.5f
      Returns:
      true if the javadoc version is equal or greater than the required version
    • addArgIf

      private void addArgIf(List<String> arguments, boolean b, String value)
      Convenience method to add an argument to the command line conditionally based on the given flag.
      Parameters:
      arguments - a list of arguments, not null
      b - the flag which controls if the argument is added or not.
      value - the argument value to be added.
    • addArgIf

      private void addArgIf(List<String> arguments, boolean b, String value, org.codehaus.plexus.languages.java.version.JavaVersion requiredJavaVersion)
      Convenience method to add an argument to the command line regarding the requested Java version.
      Parameters:
      arguments - a list of arguments, not null
      b - the flag which controls if the argument is added or not.
      value - the argument value to be added.
      requiredJavaVersion - the required Java version, for example 1.31f or 1.4f
      See Also:
    • addArgIfNotEmpty

      private void addArgIfNotEmpty(List<String> arguments, String key, String value)
      Convenience method to add an argument to the command line if the value is not null or empty.

      Moreover, the value could be comma separated.

      Parameters:
      arguments - a list of arguments, not null
      key - the argument name.
      value - the argument value to be added.
      See Also:
    • addArgIfNotEmpty

      private void addArgIfNotEmpty(List<String> arguments, String key, String value, boolean repeatKey, boolean splitValue, org.codehaus.plexus.languages.java.version.JavaVersion requiredJavaVersion)
      Convenience method to add an argument to the command line if the value is not null or empty.

      Moreover, the value could be comma separated.

      Parameters:
      arguments - a list of arguments, not null
      key - the argument name.
      value - the argument value to be added.
      repeatKey - repeat or not the key in the command line
      splitValue - if true given value will be tokenized by comma
      requiredJavaVersion - the required Java version, for example 1.31f or 1.4f
      See Also:
    • addArgIfNotEmpty

      private void addArgIfNotEmpty(List<String> arguments, String key, String value, boolean repeatKey, boolean splitValue)
      Convenience method to add an argument to the command line if the value is not null or empty.

      Moreover, the value could be comma separated.

      Parameters:
      arguments - a list of arguments, not null
      key - the argument name.
      value - the argument value to be added.
      repeatKey - repeat or not the key in the command line
      splitValue - if true given value will be tokenized by comma
    • addArgIfNotEmpty

      private void addArgIfNotEmpty(List<String> arguments, String key, String value, boolean repeatKey)
      Convenience method to add an argument to the command line if the value is not null or empty.

      Moreover, the value could be comma separated.

      Parameters:
      arguments - a list of arguments, not null
      key - the argument name.
      value - the argument value to be added.
      repeatKey - repeat or not the key in the command line
    • addArgIfNotEmpty

      private void addArgIfNotEmpty(List<String> arguments, String key, String value, org.codehaus.plexus.languages.java.version.JavaVersion requiredJavaVersion)
      Convenience method to add an argument to the command line regarding the requested Java version.
      Parameters:
      arguments - a list of arguments, not null
      key - the argument name.
      value - the argument value to be added.
      requiredJavaVersion - the required Java version, for example 1.31f or 1.4f
      See Also:
    • addArgIfNotEmpty

      private void addArgIfNotEmpty(List<String> arguments, String key, String value, org.codehaus.plexus.languages.java.version.JavaVersion requiredJavaVersion, boolean repeatKey)
      Convenience method to add an argument to the command line regarding the requested Java version.
      Parameters:
      arguments - a list of arguments, not null
      key - the argument name.
      value - the argument value to be added.
      requiredJavaVersion - the required Java version, for example 1.31f or 1.4f
      repeatKey - repeat or not the key in the command line
      See Also:
    • addLinkofflineArguments

      private void addLinkofflineArguments(List<String> arguments, Set<OfflineLink> offlineLinksList) throws org.apache.maven.reporting.MavenReportException
      Convenience method to process offlineLinks values as individual -linkoffline javadoc options.
      If detectOfflineLinks, try to add javadoc apidocs according Maven conventions for all modules given in the project.
      Parameters:
      arguments - a list of arguments, not null
      Throws:
      org.apache.maven.reporting.MavenReportException - if any
      See Also:
    • getOfflineLinks

      private Set<OfflineLink> getOfflineLinks() throws org.apache.maven.reporting.MavenReportException
      Throws:
      org.apache.maven.reporting.MavenReportException
    • addLinkArguments

      private void addLinkArguments(List<String> arguments) throws org.apache.maven.reporting.MavenReportException
      Convenience method to process links values as individual -link javadoc options. If detectLinks, try to add javadoc apidocs according Maven conventions for all dependencies given in the project.
      According to the Javadoc documentation, all defined links should have ${link}/package-list fetchable.
      Note: when a link is not fetchable:
      • Javadoc 1.4 and less throw an exception
      • Javadoc 1.5 and more display a warning
      Parameters:
      arguments - a list of arguments, not null
      Throws:
      org.apache.maven.reporting.MavenReportException - issue while generating report
      See Also:
    • copyAllResources

      private void copyAllResources(File javadocOutputDirectory) throws org.apache.maven.reporting.MavenReportException
      Copy all resources to the output directory.
      Parameters:
      javadocOutputDirectory - not null
      Throws:
      org.apache.maven.reporting.MavenReportException - if any
      See Also:
    • copyJavadocResources

      private void copyJavadocResources(File anOutputDirectory) throws IOException
      Method that copy all doc-files directories from javadocDirectory of the current project or of the projects in the reactor to the outputDirectory.
      Parameters:
      anOutputDirectory - the output directory
      Throws:
      IOException - if any
      See Also:
    • resolveDependencyBundles

      private void resolveDependencyBundles() throws IOException
      Throws:
      IOException
    • copyAdditionalJavadocResources

      private void copyAdditionalJavadocResources(File anOutputDirectory) throws org.apache.maven.reporting.MavenReportException
      Method that copy additional Javadoc resources from given artifacts.
      Parameters:
      anOutputDirectory - the output directory
      Throws:
      org.apache.maven.reporting.MavenReportException - if any
      See Also:
    • getPackageNames

      private List<String> getPackageNames(Map<Path,Collection<String>> sourcePaths)
      Parameters:
      sourcePaths - could be null
      Returns:
      the list of package names for files in the sourcePaths
    • getPackageNamesRespectingJavaModules

      private Collection<String> getPackageNamesRespectingJavaModules(Collection<JavadocModule> javadocModules) throws org.apache.maven.reporting.MavenReportException
      Parameters:
      javadocModules - not null
      Returns:
      a list of exported package names for files in allSourcePaths
      Throws:
      org.apache.maven.reporting.MavenReportException - if any
      See Also:
    • getFilesWithUnnamedPackages

      private List<String> getFilesWithUnnamedPackages(Map<Path,Collection<String>> sourcePaths)
      Parameters:
      sourcePaths - could be null
      Returns:
      a list files with unnamed package names for files in the sourcePaths
    • getSpecialFiles

      private List<String> getSpecialFiles(Map<Path,Collection<String>> sourcePaths)
      Either return only the module descriptor or all sourcefiles per sourcepath
      Parameters:
      sourcePaths - could be null
      Returns:
      a list of files
    • getModuleSourcePathFiles

      private List<String> getModuleSourcePathFiles(Map<Path,Collection<String>> sourcePaths)
    • addCommandLineOptions

      private void addCommandLineOptions(org.codehaus.plexus.util.cli.Commandline cmd, List<String> arguments, File javadocOutputDirectory) throws org.apache.maven.reporting.MavenReportException
      Generate an options file for all options and arguments and add the @options in the command line.
      Parameters:
      cmd - not null
      arguments - not null
      javadocOutputDirectory - not null
      Throws:
      org.apache.maven.reporting.MavenReportException - if any
      See Also:
    • addCommandLineArgFile

      private void addCommandLineArgFile(org.codehaus.plexus.util.cli.Commandline cmd, File javadocOutputDirectory, List<String> files) throws org.apache.maven.reporting.MavenReportException
      Generate a file called argfile (or files, depending on the JDK) to hold files and add the @argfile (or @file, depending on the JDK) in the command line.
      Parameters:
      cmd - not null
      javadocOutputDirectory - not null
      files - not null
      Throws:
      org.apache.maven.reporting.MavenReportException - if any
      See Also:
    • addCommandLinePackages

      private void addCommandLinePackages(org.codehaus.plexus.util.cli.Commandline cmd, File javadocOutputDirectory, Collection<String> packageNames) throws org.apache.maven.reporting.MavenReportException
      Generate a file called packages to hold all package names and add the @packages in the command line.
      Parameters:
      cmd - not null
      javadocOutputDirectory - not null
      packageNames - not null
      Throws:
      org.apache.maven.reporting.MavenReportException - if any
      See Also:
    • validateJavadocOptions

      private void validateJavadocOptions() throws org.apache.maven.reporting.MavenReportException
      Checks for the validity of the Javadoc options used by the user.
      Throws:
      org.apache.maven.reporting.MavenReportException - if error
    • validateStandardDocletOptions

      private void validateStandardDocletOptions() throws org.apache.maven.reporting.MavenReportException
      Checks for the validity of the Standard Doclet options.
      For example, throw an exception if <nohelp/> and <helpfile/> options are used together.
      Throws:
      org.apache.maven.reporting.MavenReportException - if error or conflict found
    • addJavadocOptions

      private void addJavadocOptions(File javadocOutputDirectory, List<String> arguments, Collection<JavadocModule> allSourcePaths, Set<OfflineLink> offlineLinks) throws org.apache.maven.reporting.MavenReportException
      Add Standard Javadoc Options.
      The package documentation details the Standard Javadoc Options wrapped by this Plugin.
      Parameters:
      javadocOutputDirectory - not null
      arguments - not null
      allSourcePaths - not null
      Throws:
      org.apache.maven.reporting.MavenReportException - if any
      See Also:
    • getResolvePathResult

      private org.codehaus.plexus.languages.java.jpms.ResolvePathResult getResolvePathResult(File artifactFile)
    • findMainDescriptor

      private Path findMainDescriptor(Collection<Path> roots) throws org.apache.maven.reporting.MavenReportException
      Throws:
      org.apache.maven.reporting.MavenReportException
    • addStandardDocletOptions

      private void addStandardDocletOptions(File javadocOutputDirectory, List<String> arguments, Set<OfflineLink> offlineLinks) throws org.apache.maven.reporting.MavenReportException
      Add Standard Doclet Options.
      The package documentation details the Standard Doclet Options wrapped by this Plugin.
      Parameters:
      javadocOutputDirectory - not null
      arguments - not null
      Throws:
      org.apache.maven.reporting.MavenReportException - if any
      See Also:
    • addGroups

      private void addGroups(List<String> arguments) throws org.apache.maven.reporting.MavenReportException
      Add groups parameter to arguments.
      Parameters:
      arguments - not null
      Throws:
      org.apache.maven.reporting.MavenReportException
    • addTags

      private void addTags(List<String> arguments) throws org.apache.maven.reporting.MavenReportException
      Add tags parameter to arguments.
      Parameters:
      arguments - not null
      Throws:
      org.apache.maven.reporting.MavenReportException
    • addTaglets

      private void addTaglets(List<String> arguments)
      Add taglets parameter to arguments.
      Parameters:
      arguments - not null
    • addTagletsFromTagletArtifacts

      private void addTagletsFromTagletArtifacts(List<String> arguments) throws org.apache.maven.reporting.MavenReportException
      Auto-detect taglets class name from tagletArtifacts and add them to arguments.
      Parameters:
      arguments - not null
      Throws:
      org.apache.maven.reporting.MavenReportException - if any
      See Also:
    • executeJavadocCommandLine

      private void executeJavadocCommandLine(org.codehaus.plexus.util.cli.Commandline cmd, File javadocOutputDirectory) throws org.apache.maven.reporting.MavenReportException
      Execute the Javadoc command line
      Parameters:
      cmd - not null
      javadocOutputDirectory - not null
      Throws:
      org.apache.maven.reporting.MavenReportException - if any errors occur
    • isUpToDate

      private boolean isUpToDate(org.codehaus.plexus.util.cli.Commandline cmd) throws org.apache.maven.reporting.MavenReportException
      Check if the javadoc is uptodate or not
      Parameters:
      cmd - not null
      Returns:
      true is the javadoc is uptodate, false otherwise
      Throws:
      org.apache.maven.reporting.MavenReportException - if any error occur
    • doExecuteJavadocCommandLine

      private void doExecuteJavadocCommandLine(org.codehaus.plexus.util.cli.Commandline cmd, File javadocOutputDirectory) throws org.apache.maven.reporting.MavenReportException
      Execute the Javadoc command line
      Parameters:
      cmd - not null
      javadocOutputDirectory - not null
      Throws:
      org.apache.maven.reporting.MavenReportException - if any errors occur
    • containsWarnings

      private boolean containsWarnings(String output)
    • isInformationalOutput

      private boolean isInformationalOutput(String str)
      Determines whether the specified string is informational output of the Javadoc tool.
      Such output should not be included as exception message or logged as warning or error.

      The following texts are either hardcoded in the tool or can be found in versions of the javadoc tool's English resource bundle of JDK 11 (and presumably later versions).
      This method will neither help nor harm for localized (non-English) versions of the tool.

      Parameters:
      str - string to check
      Returns:
      true if informational output, false if not or cannot be determined
    • getResource

      private Optional<File> getResource(File outputFile, String inputResourceName)
      Parameters:
      outputFile - not null
      inputResourceName - a not null resource in src/main/java, src/main/resources or src/main/javadoc or in the Javadoc plugin dependencies.
      Returns:
      the resource file absolute path as String
      Since:
      2.6
    • getResource

      private URL getResource(List<String> classPath, String resource)
      Parameters:
      classPath - a not null String list of files where resource will be looked up
      resource - a not null resource to find in the class path
      Returns:
      the resource from the given classpath or null if not found
      Since:
      2.6
      See Also:
    • getFullJavadocGoal

      private String getFullJavadocGoal()
      Get the full javadoc goal. Loads the plugin's pom.properties to get the current plugin version.
      Returns:
      org.apache.maven.plugins:maven-javadoc-plugin:CURRENT_VERSION:[test-]javadoc
    • isDetectOfflineLinks

      protected boolean isDetectOfflineLinks()
    • getModulesLinks

      private List<OfflineLink> getModulesLinks() throws org.apache.maven.reporting.MavenReportException
      Using Maven, a Javadoc link is given by ${project.url}/apidocs.
      Returns:
      the detected Javadoc links using the Maven conventions for all modules defined in the current project or an empty list
      Throws:
      org.apache.maven.reporting.MavenReportException - if any
      Since:
      2.6
      See Also:
    • getDependenciesLinks

      private List<String> getDependenciesLinks()
      Using Maven, a Javadoc link is given by ${project.url}/apidocs.
      Returns:
      the detected Javadoc links using the Maven conventions for all dependencies defined in the current project or an empty list.
      Since:
      2.6
      See Also:
    • matches

      private boolean matches(DependencyLink d, org.apache.maven.artifact.Artifact artifact)
    • getDefaultJavadocApiLink

      protected final OfflineLink getDefaultJavadocApiLink()
      Returns:
      if detectJavaApiLink, the Java API link based on the javaApiLinks properties and the value of the source parameter in the org.apache.maven.plugins:maven-compiler-plugin defined in ${project.build.plugins} or in ${project.build.pluginManagement}, or the javadocRuntimeVersion, or null if not defined.
      Since:
      2.6
      See Also:
    • followLinks

      private Set<String> followLinks(Set<String> links)
      Follows the given links if the Javadoc version is before 12, and returns their last redirect locations. Ordering is kept. This is necessary because the javadoc tool doesn't follow links, see JDK-8190312 (MJAVADOC-427, MJAVADOC-487)
      Parameters:
      links - Links to follow=
      Returns:
      last redirect location of all the links
    • isValidJavadocLink

      protected boolean isValidJavadocLink(String link, boolean detecting)
      Parameters:
      link - not null
      detecting - true if the link is generated by detectLinks, or false otherwise
      Returns:
      true if the link has a /package-list, false otherwise.
      Since:
      2.6
      See Also:
    • writeDebugJavadocScript

      private void writeDebugJavadocScript(String cmdLine, File javadocOutputDirectory)
      Write a debug javadoc script in case of command line error or in debug mode.
      Parameters:
      cmdLine - the current command line as string, not null.
      javadocOutputDirectory - the output dir, not null.
      Since:
      2.6
      See Also:
    • isJavadocVMInitError

      private boolean isJavadocVMInitError(String output)
      Check if the Javadoc JVM is correctly started or not.
      Parameters:
      output - the command line output, not null.
      Returns:
      true if Javadoc output command line contains Javadoc word, false otherwise.
      Since:
      2.6.1
      See Also:
    • getJavadocLink

      private static String getJavadocLink(org.apache.maven.project.MavenProject project)
      Parameters:
      project - not null
      Returns:
      the javadoc link based on the project URL i.e. ${project.url}/apidocs.
      Since:
      2.6
    • cleanUrl

      private static String cleanUrl(String url)
      Parameters:
      url - could be null
      Returns:
      the cleaned URL or empty if url was null
      Since:
      2.6
    • getPlugin

      private static org.apache.maven.model.Plugin getPlugin(org.apache.maven.project.MavenProject project, String pluginId)
      Parameters:
      project - not null
      pluginId - not null key of the plugin defined in PluginContainer.getPluginsAsMap() or in PluginContainer.getPluginsAsMap()
      Returns:
      the Maven plugin defined in ${project.build.plugins} or in ${project.build.pluginManagement}, or null if not defined
      Since:
      2.6
    • getPluginParameter

      private static String getPluginParameter(org.apache.maven.project.MavenProject project, String pluginId, String param)
      Parameters:
      project - the Maven project
      pluginId - not null
      param - not null
      Returns:
      the string parameter defined in the plugin configuration by param key or null if not found.
      Since:
      2.6
    • getJavadocOptionsFile

      protected final File getJavadocOptionsFile()
      Construct the output file for the generated javadoc-options XML file, after creating the javadocOptionsDir if necessary. This method does NOT write to the file in question.
      Returns:
      The options File file.
      Since:
      2.7
    • buildJavadocOptions

      protected final JavadocOptions buildJavadocOptions() throws IOException
      Generate a javadoc-options XML file, for either bundling with a javadoc-resources artifact OR supplying to a distro module in a includeDependencySources configuration, so the javadoc options from this execution can be reconstructed and merged in the distro build.
      Returns:
      JavadocOptions
      Throws:
      IOException - IOException
      Since:
      2.7
    • getAttachmentClassifier

      protected String getAttachmentClassifier()
      Override this if you need to provide a bundle attachment classifier, as in the case of test javadocs.
      Returns:
      the attachment classifier
    • logError

      protected void logError(String message, Throwable t)
      Logs an error with throwable content only if in debug.
      Parameters:
      message - the message which should be announced
      t - the throwable part of the message
    • getReactorProjects

      protected List<org.apache.maven.project.MavenProject> getReactorProjects()
    • failOnError

      protected void failOnError(String prefix, Exception e) throws org.apache.maven.plugin.MojoExecutionException
      Parameters:
      prefix - the prefix of the exception
      e - the exception
      Throws:
      org.apache.maven.plugin.MojoExecutionException - MojoExecutionException issue while generating report
    • getAggregatedProjects

      private List<org.apache.maven.project.MavenProject> getAggregatedProjects()
      Returns:
      list of projects to be part of aggregated javadoc
    • isSkippedModule

      protected boolean isSkippedModule(org.apache.maven.project.MavenProject mavenProject)
      Parameters:
      mavenProject - the project that might be skipped
      Returns:
      true if the project needs to be skipped from aggregate generation
    • isSkippedJavadoc

      protected boolean isSkippedJavadoc(org.apache.maven.project.MavenProject mavenProject)
      Parameters:
      mavenProject - the project that might be skipped
      Returns:
      true if the pom configuration skips javadoc generation for the project