public abstract class AbstractJavadocMojo
extends org.apache.maven.plugin.AbstractMojo
Modifier and Type | Field and Description |
---|---|
protected static String |
ARGFILE_FILE_NAME
The
argfile file name in the output directory when calling:
javadoc.exe(or .sh) @options @packages | @argfile | @files |
protected static String |
DEBUG_JAVADOC_SCRIPT_NAME
The Javadoc script file name when
debug parameter is on, i.e. |
protected boolean |
failOnError
Specifies if the build will fail if there are errors during javadoc execution or not.
|
protected boolean |
failOnWarnings
Specifies if the build will fail if there are warning during javadoc execution or not.
|
protected static String |
FILES_FILE_NAME
The
files file name in the output directory when calling:
javadoc.exe(or .sh) @options @packages | @argfile | @files |
static 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.
|
protected ArrayList<String> |
links
Creates links to existing javadoc-generated documentation of external referenced classes.
|
protected static String |
OPTIONS_FILE_NAME
The
options file name in the output directory when calling:
javadoc.exe(or .sh) @options @packages | @argfile | @files |
protected File |
outputDirectory
Specifies the destination directory where javadoc saves the generated HTML files.
|
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). |
protected static String |
PACKAGES_FILE_NAME
The
packages file name in the output directory when calling:
javadoc.exe(or .sh) @options @packages | @argfile | @files |
protected org.apache.maven.project.MavenProject |
project
The Maven Project Object
|
protected org.apache.maven.execution.MavenSession |
session
The current build session instance.
|
protected boolean |
skip
Specifies whether the Javadoc generation should be skipped.
|
static 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.
|
protected boolean |
useStandardDocletOptions
Specifies to use the
options provided by the Standard Doclet for a custom doclet.
|
Constructor and Description |
---|
AbstractJavadocMojo() |
Modifier and Type | Method and Description |
---|---|
protected JavadocOptions |
buildJavadocOptions()
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.
|
protected boolean |
canGenerateReport(Map<Path,Collection<String>> files)
Method that indicates whether the javadoc can be generated or not.
|
protected SourceResolverConfig |
configureDependencySourceResolution(SourceResolverConfig config)
Override this method to customize the configuration for resolving dependency sources.
|
void |
execute() |
protected void |
executeReport(Locale unusedLocale)
The package documentation details the
Javadoc Options used by this Plugin.
|
protected void |
failOnError(String prefix,
Exception e) |
protected String |
getAttachmentClassifier()
Override this if you need to provide a bundle attachment classifier, as in the case of test
javadocs.
|
protected File |
getClassesFile(org.apache.maven.project.MavenProject project) |
protected OfflineLink |
getDefaultJavadocApiLink() |
protected org.eclipse.aether.util.filter.ScopeDependencyFilter |
getDependencyScopeFilter() |
protected Collection<JavadocModule> |
getDependencySourcePaths()
Resolve dependency sources so they can be included directly in the javadoc process.
|
protected String |
getDoclint() |
protected String |
getDoctitle() |
protected List<String> |
getExecutionProjectSourceRoots(org.apache.maven.project.MavenProject p) |
protected Map<Path,Collection<String>> |
getFiles(Collection<Path> sourcePaths)
Method to get the files on the specified source paths
|
protected File |
getJavadocDirectory() |
protected File |
getJavadocOptionsFile()
Construct the output file for the generated javadoc-options XML file, after creating the
javadocOptionsDir if necessary.
|
protected String |
getOutputDirectory() |
protected File |
getOverview() |
protected org.apache.maven.project.MavenProject |
getProject() |
protected List<File> |
getProjectBuildOutputDirs(org.apache.maven.project.MavenProject p) |
protected List<String> |
getProjectSourceRoots(org.apache.maven.project.MavenProject p) |
protected Collection<JavadocModule> |
getSourcePaths()
Method to get the source paths per reactorProject.
|
protected org.apache.maven.toolchain.Toolchain |
getToolchain() |
protected String |
getWindowtitle() |
protected boolean |
isAggregator()
Indicates whether this goal is flagged with
@aggregator . |
protected boolean |
isSkippedJavadoc(org.apache.maven.project.MavenProject mavenProject) |
protected boolean |
isSkippedModule(org.apache.maven.project.MavenProject mavenProject) |
protected boolean |
isTest()
Indicates whether this goal generates documentation for the
Java Test code . |
protected boolean |
isValidJavadocLink(String link,
boolean detecting) |
protected void |
logError(String message,
Throwable t)
Logs an error with throwable content only if in debug.
|
org.apache.maven.artifact.Artifact |
resolveDependency(org.apache.maven.model.Dependency dependency) |
protected void |
verifyRemovedParameter(String paramName) |
public static final String JAVADOC_RESOURCES_ATTACHMENT_CLASSIFIER
TEST_JAVADOC_RESOURCES_ATTACHMENT_CLASSIFIER
,
Constant Field Valuespublic static final String TEST_JAVADOC_RESOURCES_ATTACHMENT_CLASSIFIER
JAVADOC_RESOURCES_ATTACHMENT_CLASSIFIER
,
Constant Field Valuesprotected static final String DEBUG_JAVADOC_SCRIPT_NAME
debug
parameter is on, i.e. javadoc.bat or javadoc.shprotected static final String OPTIONS_FILE_NAME
options
file name in the output directory when calling:
javadoc.exe(or .sh) @options @packages | @argfile | @files
protected static final String PACKAGES_FILE_NAME
packages
file name in the output directory when calling:
javadoc.exe(or .sh) @options @packages | @argfile | @files
protected static final String ARGFILE_FILE_NAME
argfile
file name in the output directory when calling:
javadoc.exe(or .sh) @options @packages | @argfile | @files
protected static final String FILES_FILE_NAME
files
file name in the output directory when calling:
javadoc.exe(or .sh) @options @packages | @argfile | @files
@Parameter(defaultValue="${session}", readonly=true, required=true) protected org.apache.maven.execution.MavenSession session
@Parameter(defaultValue="${project}", readonly=true, required=true) protected org.apache.maven.project.MavenProject project
@Parameter(property="maven.javadoc.skip", defaultValue="false") protected boolean skip
@Parameter(property="maven.javadoc.failOnError", defaultValue="true") protected boolean failOnError
@Parameter(property="maven.javadoc.failOnWarnings", defaultValue="false") protected boolean failOnWarnings
@Parameter(property="useStandardDocletOptions", defaultValue="true") protected boolean useStandardDocletOptions
<docletArtifacts> <docletArtifact> <groupId>com.sun.tools.doclets</groupId> <artifactId>doccheck</artifactId> <version>1.2b2</version> </docletArtifact> </docletArtifacts> <useStandardDocletOptions>true</useStandardDocletOptions>
@Parameter(property="links") protected ArrayList<String> links
Notes:
<offline>
setting or specifying -o, --offline
or -Dmaven.javadoc.offline=true
on the
command line./package-list
or /element-list
(since Java 10). For instance:
<links> <link>https://docs.oracle.com/en/java/javase/17/docs/api</link> <links>will be used because
https://docs.oracle.com/en/java/javase/17/docs/api/element-list
exists.detectLinks
is defined, the links between the project dependencies are
automatically added.detectJavaApiLink
is defined, a Java API link, based on the Java version of the
project's sources, will be added automatically.@Parameter(property="destDir", alias="destDir", defaultValue="${project.build.directory}/apidocs", required=true) protected File outputDirectory
@Parameter(defaultValue="${project.build.outputTimestamp}") protected String outputTimestamp
yyyy-MM-dd'T'HH:mm:ssXXX
or as an int representing seconds since the epoch (like
SOURCE_DATE_EPOCH).protected boolean isAggregator()
@aggregator
.true
if the goal is designed as an aggregator, false
otherwise.AggregatorJavadocReport
,
AggregatorTestJavadocReport
protected boolean isTest()
Java Test code
.true
if the goal generates Test Javadocs, false
otherwise.protected String getOutputDirectory()
protected org.apache.maven.project.MavenProject getProject()
protected List<File> getProjectBuildOutputDirs(org.apache.maven.project.MavenProject p)
p
- not null maven projectprotected File getClassesFile(org.apache.maven.project.MavenProject project)
project
- the project in which to find a classes fileprotected List<String> getProjectSourceRoots(org.apache.maven.project.MavenProject p)
p
- not null maven projectprotected List<String> getExecutionProjectSourceRoots(org.apache.maven.project.MavenProject p)
p
- not null maven projectprotected File getJavadocDirectory()
protected String getDoclint()
protected String getDoctitle()
protected File getOverview()
javadocdirectory
protected String getWindowtitle()
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
protected final void verifyRemovedParameter(String paramName)
protected void executeReport(Locale unusedLocale) throws org.apache.maven.reporting.MavenReportException
unusedLocale
- the wanted locale (actually unused).org.apache.maven.reporting.MavenReportException
- if anyprotected Map<Path,Collection<String>> getFiles(Collection<Path> sourcePaths) throws org.apache.maven.reporting.MavenReportException
sourcePaths
- a Collection that contains the paths to the source filesorg.apache.maven.reporting.MavenReportException
- MavenReportException
issue while generating reportprotected Collection<JavadocModule> getSourcePaths() throws org.apache.maven.reporting.MavenReportException
org.apache.maven.reporting.MavenReportException
- MavenReportException
issue while generating reportJavadocUtil.pruneDirs(MavenProject, Collection)
protected SourceResolverConfig configureDependencySourceResolution(SourceResolverConfig config)
config
- SourceResolverConfig
SourceResolverConfig
protected final Collection<JavadocModule> getDependencySourcePaths() throws org.apache.maven.reporting.MavenReportException
configureDependencySourceResolution(SourceResolverConfig)
.org.apache.maven.reporting.MavenReportException
- MavenReportException
protected boolean canGenerateReport(Map<Path,Collection<String>> files)
files
- the project filesprotected org.eclipse.aether.util.filter.ScopeDependencyFilter getDependencyScopeFilter()
public org.apache.maven.artifact.Artifact resolveDependency(org.apache.maven.model.Dependency dependency) throws org.apache.maven.reporting.MavenReportException
dependency
- Dependency
Artifact
org.apache.maven.reporting.MavenReportException
- when artifact could not be resolvedprotected final org.apache.maven.toolchain.Toolchain getToolchain()
protected final OfflineLink getDefaultJavadocApiLink()
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.protected boolean isValidJavadocLink(String link, boolean detecting)
link
- not nulldetecting
- true
if the link is generated by
detectLinks
, or false
otherwisetrue
if the link has a /package-list
, false
otherwise.protected final File getJavadocOptionsFile()
File
file.protected final JavadocOptions buildJavadocOptions() throws IOException
JavadocOptions
IOException
- IOException
protected String getAttachmentClassifier()
protected void logError(String message, Throwable t)
message
- The message which should be announced.t
- The throwable part of the message.protected void failOnError(String prefix, Exception e) throws org.apache.maven.plugin.MojoExecutionException
prefix
- The prefix of the exception.e
- The exception.org.apache.maven.plugin.MojoExecutionException
- MojoExecutionException
issue while generating reportprotected boolean isSkippedModule(org.apache.maven.project.MavenProject mavenProject)
mavenProject
- the project that might be skippedtrue
if the project needs to be skipped from aggregate generationprotected boolean isSkippedJavadoc(org.apache.maven.project.MavenProject mavenProject)
mavenProject
- the project that might be skippedtrue
if the pom configuration skips javadoc generation for the projectCopyright © 2004–2023 The Apache Software Foundation. All rights reserved.