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.AbstractMavenReport
Base class for the JXR reports.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private String
    String used at the bottom of the Xref HTML files.
    private String
    Title of main page of the Xref HTML files.
    private ArrayList<String>
    A list of exclude patterns to use.
    private ArrayList<String>
    A list of include patterns to use.
    private org.codehaus.plexus.languages.java.version.JavaVersion
    Version of the Javadoc templates to use.
    private String
    Version of the Javadoc templates to use.
    private boolean
    Link the Javadoc from the Source XRef.
    protected List<org.apache.maven.project.MavenProject>
    The projects in the reactor for aggregation report.
    private org.apache.maven.execution.MavenSession
     
    protected boolean
    Whether to skip this execution.
    private String
    Style sheet used for the Xref HTML files.
    private String
    Directory where Velocity templates can be found to generate overviews, frames and summaries.
    private String
    Title 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

    Fields inherited from interface org.apache.maven.reporting.MavenReport

    CATEGORY_PROJECT_INFORMATION, CATEGORY_PROJECT_REPORTS, ROLE

    Fields inherited from interface org.apache.maven.plugin.Mojo

    ROLE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    protected List<String>
    Gets the list of the source directories to be included in the JXR report generation
    private void
    Copy some required resources (like the stylesheet) to the given directory
    private void
    copyResources(String dir, String sourceDirectory, String... files)
    Copy styles and related resources to the given directory
    private void
    createXref(Locale locale, String destinationDirectory, List<String> sourceDirs)
    Creates the Xref for the Java files found in the given source directory and puts them in the given destination directory.
    protected void
     
    private String
    Returns the bottom text to be displayed at the lower part of the generated JXR reports.
    protected ResourceBundle
    getBundle(Locale locale)
    Returns the correct resource bundle according to the locale.
    protected abstract String
    Abstract method that returns the target directory where the generated JXR reports will be put.
    protected abstract File
    Abstract method that returns the directory of the javadoc files.
    private Path
     
    protected org.apache.maven.project.MavenProject
     
    protected org.apache.maven.execution.MavenSession
    Returns the Maven session.
    protected abstract List<String>
    Abstract method that returns the specified source directories that will be included in the JXR report generation.
    protected abstract List<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
    private String
    Determine the templateDir to use, given javadocTemplatesVersion
    private boolean
    Checks whether the given directory contains Java files.
    protected void
    Initialize some attributes required during the report generation
    protected boolean
    Is the current report aggregated?
    boolean
     
    protected List<String>
    Compiles the list of directories which contain source files that will be included in the JXR report generation.
    private void
    Sets a new value for javadocTemplatesVersion.

    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.maven.reporting.MavenReport

    getDescription, getName, getOutputName, getOutputPath
  • Field Details

    • session

      @Parameter(defaultValue="${session}", readonly=true, required=true) private org.apache.maven.execution.MavenSession session
    • windowTitle

      @Parameter(defaultValue="${project.name} ${project.version} Reference") private String windowTitle
      Title of window of the Xref HTML files.
    • docTitle

      @Parameter(defaultValue="${project.name} ${project.version} Reference") private String docTitle
      Title of main page of the Xref HTML files.
    • bottom

      @Parameter(property="bottom", defaultValue="Copyright &#169; {inceptionYear}&#x2013;{currentYear} {organizationName}. All rights reserved.") private String bottom
      String used at the bottom of the Xref HTML files.
    • templateDir

      @Parameter private 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 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 ArrayList<String> excludes
      A list of exclude patterns to use. By default no files are excluded.
      Since:
      2.1
    • includes

      @Parameter private ArrayList<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 List<org.apache.maven.project.MavenProject> reactorProjects
      The projects in the reactor for aggregation report.
    • skip

      @Parameter(property="maven.jxr.skip", defaultValue="false") protected boolean skip
      Whether 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 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.
  • Constructor Details

    • AbstractJxrReport

      public AbstractJxrReport()
  • Method Details

    • pruneSourceDirs

      protected List<String> pruneSourceDirs(List<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(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(Locale locale, String destinationDirectory, List<String> sourceDirs) throws IOException, JxrException
      Creates 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 generation
      destinationDirectory - The output directory
      sourceDirs - The source directories
      Throws:
      IOException
      JxrException
    • getBottomText

      private String getBottomText()
      Returns the bottom text to be displayed at the lower part of the generated JXR reports.
    • copyRequiredResources

      private void copyRequiredResources(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(String dir, String sourceDirectory, String... files)
      Copy styles and related resources to the given directory
      Parameters:
      dir - the directory to copy the resources to
      sourceDirectory - resources subdirectory to copy from
      files - names of files to copy
    • getProject

      protected org.apache.maven.project.MavenProject getProject()
      Overrides:
      getProject in class org.apache.maven.reporting.AbstractMavenReport
    • getSession

      protected org.apache.maven.execution.MavenSession getSession()
      Returns the Maven session.
      Returns:
      Maven session
    • getBundle

      protected ResourceBundle getBundle(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(Locale locale) throws org.apache.maven.reporting.MavenReportException
      Specified by:
      executeReport in class org.apache.maven.reporting.AbstractMavenReport
      Throws:
      org.apache.maven.reporting.MavenReportException
    • getTemplateDir

      private String getTemplateDir()
      Determine the templateDir to use, given javadocTemplatesVersion
      Returns:
    • setJavadocTemplatesVersion

      private void setJavadocTemplatesVersion()
      Sets a new value for javadocTemplatesVersion.
    • constructSourceDirs

      protected List<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:
      canGenerateReport in interface org.apache.maven.reporting.MavenReport
      Overrides:
      canGenerateReport in class org.apache.maven.reporting.AbstractMavenReport
    • isExternalReport

      public boolean isExternalReport()
      Specified by:
      isExternalReport in interface org.apache.maven.reporting.MavenReport
      Overrides:
      isExternalReport in class org.apache.maven.reporting.AbstractMavenReport
    • getJavadocLocation

      private Path getJavadocLocation() throws IOException
      Returns:
      a String that contains the location of the javadocs
      Throws:
      IOException
    • getDestinationDirectory

      protected abstract 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 List<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 List<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 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