Class 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 java.lang.String bottom
      String used at the bottom of the Xref HTML files.
      private java.lang.String docTitle
      Title of main page of the Xref HTML files.
      private java.util.ArrayList<java.lang.String> excludes
      A list of exclude patterns to use.
      private java.util.ArrayList<java.lang.String> includes
      A list of include patterns to use.
      private org.codehaus.plexus.languages.java.version.JavaVersion javadocTemplatesVersion
      Version of the Javadoc templates to use.
      private java.lang.String javadocVersion
      Version of the Javadoc templates to use.
      private boolean linkJavadoc
      Link the Javadoc from the Source XRef.
      protected java.util.List<org.apache.maven.project.MavenProject> reactorProjects
      The projects in the reactor for aggregation report.
      private org.apache.maven.execution.MavenSession session  
      protected boolean skip
      Whether to skip this execution.
      private java.lang.String stylesheet
      Style sheet used for the Xref HTML files.
      private java.lang.String templateDir
      Directory where Velocity templates can be found to generate overviews, frames and summaries.
      private java.lang.String windowTitle
      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
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canGenerateReport()  
      protected java.util.List<java.lang.String> constructSourceDirs()
      Gets the list of the source directories to be included in the JXR report generation
      private void copyRequiredResources​(java.lang.String dir)
      Copy some required resources (like the stylesheet) to the given directory
      private void copyResources​(java.lang.String dir, java.lang.String sourceDirectory, java.lang.String... files)
      Copy styles and related resources to the given directory
      private void createXref​(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 void executeReport​(java.util.Locale locale)  
      private java.lang.String getBottomText()
      Returns the bottom text to be displayed at the lower part of the generated JXR reports.
      protected java.util.ResourceBundle getBundle​(java.util.Locale locale)
      Returns the correct resource bundle according to the locale.
      protected abstract java.lang.String getDestinationDirectory()
      Abstract method that returns the target directory where the generated JXR reports will be put.
      protected abstract java.io.File getJavadocDir()
      Abstract method that returns the directory of the javadoc files.
      private java.nio.file.Path getJavadocLocation()  
      protected org.apache.maven.project.MavenProject getProject()  
      protected org.apache.maven.execution.MavenSession getSession()
      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 generation
      private java.lang.String getTemplateDir()
      Determine the templateDir to use, given javadocTemplatesVersion
      private boolean hasSources​(java.io.File dir)
      Checks whether the given directory contains Java files.
      protected void init()
      Initialize some attributes required during the report generation
      protected boolean isAggregate()
      Is the current report aggregated?
      boolean isExternalReport()  
      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 void setJavadocTemplatesVersion()
      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 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 windowTitle
        Title of window of the Xref HTML files.
      • docTitle

        @Parameter(defaultValue="${project.name} ${project.version} Reference")
        private java.lang.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 java.lang.String bottom
        String 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> 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 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.
    • Constructor Detail

      • AbstractJxrReport

        public AbstractJxrReport()
    • 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,
                                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:
        java.io.IOException
        JxrException
      • 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 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 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:
        executeReport in class org.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 for javadocTemplatesVersion.
      • 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:
        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 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