Package org.apache.maven.plugin.jxr
Class AbstractJxrReport
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.reporting.AbstractMavenReport
-
- org.apache.maven.plugin.jxr.AbstractJxrReport
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo,org.apache.maven.reporting.MavenMultiPageReport,org.apache.maven.reporting.MavenReport
- Direct Known Subclasses:
JxrReport,JxrTestReport
public abstract class AbstractJxrReport extends org.apache.maven.reporting.AbstractMavenReportBase class for the JXR reports.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringbottomString used at the bottom of the Xref HTML files.private java.lang.StringdocTitleTitle of main page of the Xref HTML files.private java.util.ArrayList<java.lang.String>excludesA list of exclude patterns to use.private java.util.ArrayList<java.lang.String>includesA list of include patterns to use.private org.codehaus.plexus.languages.java.version.JavaVersionjavadocTemplatesVersionVersion of the Javadoc templates to use.private java.lang.StringjavadocVersionVersion of the Javadoc templates to use.private booleanlinkJavadocLink the Javadoc from the Source XRef.protected java.util.List<org.apache.maven.project.MavenProject>reactorProjectsThe projects in the reactor for aggregation report.private org.apache.maven.execution.MavenSessionsessionprotected booleanskipWhether to skip this execution.private java.lang.StringstylesheetStyle sheet used for the Xref HTML files.private java.lang.StringtemplateDirDirectory where Velocity templates can be found to generate overviews, frames and summaries.private java.lang.StringwindowTitleTitle of window of the Xref HTML files.-
Fields inherited from class org.apache.maven.reporting.AbstractMavenReport
locale, mojoExecution, outputDirectory, outputFormat, outputTimestamp, project, remoteProjectRepositories, repoSession, siteDirectory, siteRenderer, siteTool
-
-
Constructor Summary
Constructors Constructor Description AbstractJxrReport()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleancanGenerateReport()protected java.util.List<java.lang.String>constructSourceDirs()Gets the list of the source directories to be included in the JXR report generationprivate voidcopyRequiredResources(java.lang.String dir)Copy some required resources (like the stylesheet) to the given directoryprivate voidcopyResources(java.lang.String dir, java.lang.String sourceDirectory, java.lang.String... files)Copy styles and related resources to the given directoryprivate voidcreateXref(java.util.Locale locale, java.lang.String destinationDirectory, java.util.List<java.lang.String> sourceDirs)Creates the Xref for the Java files found in the given source directory and puts them in the given destination directory.protected voidexecuteReport(java.util.Locale locale)private java.lang.StringgetBottomText()Returns the bottom text to be displayed at the lower part of the generated JXR reports.protected java.util.ResourceBundlegetBundle(java.util.Locale locale)Returns the correct resource bundle according to the locale.protected abstract java.lang.StringgetDestinationDirectory()Abstract method that returns the target directory where the generated JXR reports will be put.protected abstract java.io.FilegetJavadocDir()Abstract method that returns the directory of the javadoc files.private java.nio.file.PathgetJavadocLocation()protected org.apache.maven.project.MavenProjectgetProject()protected org.apache.maven.execution.MavenSessiongetSession()Returns the Maven session.protected abstract java.util.List<java.lang.String>getSourceRoots()Abstract method that returns the specified source directories that will be included in the JXR report generation.protected abstract java.util.List<java.lang.String>getSourceRoots(org.apache.maven.project.MavenProject project)Abstract method that returns the compile source directories of the specified project that will be included in the JXR report generationprivate java.lang.StringgetTemplateDir()Determine the templateDir to use, given javadocTemplatesVersionprivate booleanhasSources(java.io.File dir)Checks whether the given directory contains Java files.protected voidinit()Initialize some attributes required during the report generationprotected booleanisAggregate()Is the current report aggregated?booleanisExternalReport()protected java.util.List<java.lang.String>pruneSourceDirs(java.util.List<java.lang.String> sourceDirs)Compiles the list of directories which contain source files that will be included in the JXR report generation.private voidsetJavadocTemplatesVersion()Sets a new value forjavadocTemplatesVersion.-
Methods inherited from class org.apache.maven.reporting.AbstractMavenReport
closeReport, constructXrefLocation, execute, generate, generate, getCategoryName, getInputEncoding, getLocale, getOutputDirectory, getOutputEncoding, getReportOutputDirectory, getSink, getSinkFactory, getSiteRenderer, getXrefLocation, setReportOutputDirectory
-
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
-
-
-
Field Detail
-
session
@Parameter(defaultValue="${session}", readonly=true, required=true) private org.apache.maven.execution.MavenSession session
-
windowTitle
@Parameter(defaultValue="${project.name} ${project.version} Reference") private java.lang.String windowTitleTitle of window of the Xref HTML files.
-
docTitle
@Parameter(defaultValue="${project.name} ${project.version} Reference") private java.lang.String docTitleTitle of main page of the Xref HTML files.
-
bottom
@Parameter(property="bottom", defaultValue="Copyright © {inceptionYear}–{currentYear} {organizationName}. All rights reserved.") private java.lang.String bottomString used at the bottom of the Xref HTML files.
-
templateDir
@Parameter private java.lang.String templateDir
Directory where Velocity templates can be found to generate overviews, frames and summaries. Should not be used. If used, should be an absolute path, like"${basedir}/myTemplates".
-
stylesheet
@Parameter private java.lang.String stylesheet
Style sheet used for the Xref HTML files. Should not be used. If used, should be an absolute path, like"${basedir}/myStyles.css".
-
excludes
@Parameter private java.util.ArrayList<java.lang.String> excludes
A list of exclude patterns to use. By default no files are excluded.- Since:
- 2.1
-
includes
@Parameter private java.util.ArrayList<java.lang.String> includes
A list of include patterns to use. By default all .java files are included.- Since:
- 2.1
-
reactorProjects
@Parameter(defaultValue="${reactorProjects}", readonly=true) protected java.util.List<org.apache.maven.project.MavenProject> reactorProjectsThe projects in the reactor for aggregation report.
-
skip
@Parameter(property="maven.jxr.skip", defaultValue="false") protected boolean skipWhether to skip this execution.- Since:
- 2.3
-
linkJavadoc
@Parameter(defaultValue="true") private boolean linkJavadoc
Link the Javadoc from the Source XRef. Defaults to true and will link automatically if javadoc plugin is being used.
-
javadocVersion
@Parameter(property="javadocVersion") private java.lang.String javadocVersion
Version of the Javadoc templates to use. The value should reflect `java.specification.version`, "1.4", "1.8", "9", "10", by default this system property is used.
-
javadocTemplatesVersion
private org.codehaus.plexus.languages.java.version.JavaVersion javadocTemplatesVersion
Version of the Javadoc templates to use.
-
-
Method Detail
-
pruneSourceDirs
protected java.util.List<java.lang.String> pruneSourceDirs(java.util.List<java.lang.String> sourceDirs)
Compiles the list of directories which contain source files that will be included in the JXR report generation.- Parameters:
sourceDirs- the List of the source directories- Returns:
- a List of the directories that will be included in the JXR report generation
-
init
protected void init()
Initialize some attributes required during the report generation
-
hasSources
private boolean hasSources(java.io.File dir)
Checks whether the given directory contains Java files.- Parameters:
dir- the source directory- Returns:
- true if the directory or one of its subdirectories contains at least 1 Java file
-
createXref
private void createXref(java.util.Locale locale, java.lang.String destinationDirectory, java.util.List<java.lang.String> sourceDirs) throws java.io.IOException, JxrExceptionCreates the Xref for the Java files found in the given source directory and puts them in the given destination directory.- Parameters:
locale- The user locale to use for the Xref generationdestinationDirectory- The output directorysourceDirs- The source directories- Throws:
java.io.IOExceptionJxrException
-
getBottomText
private java.lang.String getBottomText()
Returns the bottom text to be displayed at the lower part of the generated JXR reports.
-
copyRequiredResources
private void copyRequiredResources(java.lang.String dir)
Copy some required resources (like the stylesheet) to the given directory- Parameters:
dir- the directory to copy the resources to
-
copyResources
private void copyResources(java.lang.String dir, java.lang.String sourceDirectory, java.lang.String... files)Copy styles and related resources to the given directory- Parameters:
dir- the directory to copy the resources tosourceDirectory- resources subdirectory to copy fromfiles- names of files to copy
-
getProject
protected org.apache.maven.project.MavenProject getProject()
- Overrides:
getProjectin classorg.apache.maven.reporting.AbstractMavenReport
-
getSession
protected org.apache.maven.execution.MavenSession getSession()
Returns the Maven session.- Returns:
- Maven session
-
getBundle
protected java.util.ResourceBundle getBundle(java.util.Locale locale)
Returns the correct resource bundle according to the locale.- Parameters:
locale- the locale of the user- Returns:
- the bundle corresponding to the locale
-
executeReport
protected void executeReport(java.util.Locale locale) throws org.apache.maven.reporting.MavenReportException- Specified by:
executeReportin classorg.apache.maven.reporting.AbstractMavenReport- Throws:
org.apache.maven.reporting.MavenReportException
-
getTemplateDir
private java.lang.String getTemplateDir()
Determine the templateDir to use, given javadocTemplatesVersion- Returns:
-
setJavadocTemplatesVersion
private void setJavadocTemplatesVersion()
Sets a new value forjavadocTemplatesVersion.
-
constructSourceDirs
protected java.util.List<java.lang.String> constructSourceDirs()
Gets the list of the source directories to be included in the JXR report generation- Returns:
- a List of the source directories whose contents will be included in the JXR report generation
-
canGenerateReport
public boolean canGenerateReport()
- Specified by:
canGenerateReportin interfaceorg.apache.maven.reporting.MavenReport- Overrides:
canGenerateReportin classorg.apache.maven.reporting.AbstractMavenReport
-
isExternalReport
public boolean isExternalReport()
- Specified by:
isExternalReportin interfaceorg.apache.maven.reporting.MavenReport- Overrides:
isExternalReportin classorg.apache.maven.reporting.AbstractMavenReport
-
getJavadocLocation
private java.nio.file.Path getJavadocLocation() throws java.io.IOException- Returns:
- a String that contains the location of the javadocs
- Throws:
java.io.IOException
-
getDestinationDirectory
protected abstract java.lang.String getDestinationDirectory()
Abstract method that returns the target directory where the generated JXR reports will be put.- Returns:
- a String that contains the target directory name
-
getSourceRoots
protected abstract java.util.List<java.lang.String> getSourceRoots()
Abstract method that returns the specified source directories that will be included in the JXR report generation.- Returns:
- a List of the source directories
-
getSourceRoots
protected abstract java.util.List<java.lang.String> getSourceRoots(org.apache.maven.project.MavenProject project)
Abstract method that returns the compile source directories of the specified project that will be included in the JXR report generation- Parameters:
project- the MavenProject where the JXR report plugin will be executed- Returns:
- a List of the source directories
-
getJavadocDir
protected abstract java.io.File getJavadocDir()
Abstract method that returns the directory of the javadoc files.- Returns:
- a File for the directory of the javadocs
-
isAggregate
protected boolean isAggregate()
Is the current report aggregated?- Returns:
- true if aggregate, false otherwise
-
-