Class AbstractBuildinfoMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
    Direct Known Subclasses:
    BuildinfoMojo, CompareMojo

    public abstract class AbstractBuildinfoMojo
    extends org.apache.maven.plugin.AbstractMojo
    Base buildinfo-generating class, for goals related to Reproducible Builds .buildinfo files.
    Since:
    3.2.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.apache.maven.artifact.handler.manager.ArtifactHandlerManager artifactHandlerManager  
      protected java.io.File buildinfoFile
      Location of the generated buildinfo file.
      private boolean detectSkip
      Detect projects/modules with install or deploy skipped: avoid taking fingerprints.
      private java.util.List<java.lang.String> ignore
      Artifacts to ignore, specified as a glob matching against ${groupId}/${filename}, for example */*.xml.
      private boolean ignoreJavadoc
      Ignore javadoc attached artifacts from buildinfo generation.
      private java.lang.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 org.apache.maven.project.MavenProject project
      The Maven project.
      private boolean reproducible
      Makes the generated .buildinfo file reproducible, by dropping detailed environment recording: OS will be recorded as "Windows" or "Unix", JVM version as major version only.
      protected org.apache.maven.rtinfo.RuntimeInformation rtInformation  
      protected org.apache.maven.execution.MavenSession session
      The current build session instance.
      private java.util.List<java.lang.String> skipModules
      Avoid taking fingerprints for modules specified as glob matching against ${groupId}/${artifactId}.
      private java.util.List<java.nio.file.PathMatcher> skipModulesMatcher  
      private org.apache.maven.toolchain.ToolchainManager toolchainManager
      To obtain a toolchain if possible.
      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected void copyAggregateToRoot​(java.io.File aggregate)  
      void execute()  
      (package private) abstract void execute​(java.util.Map<org.apache.maven.artifact.Artifact,​java.lang.String> artifacts)
      Execute after buildinfo has been generated for current build (eventually aggregated).
      protected java.util.Map<org.apache.maven.artifact.Artifact,​java.lang.String> generateBuildinfo​(boolean mono)
      Generate buildinfo file.
      protected org.apache.maven.project.MavenProject getExecutionRoot()  
      private org.apache.maven.project.MavenProject getLastProject()  
      private org.apache.maven.toolchain.Toolchain getToolchain()  
      (package private) static boolean hasBadOutputTimestamp​(java.lang.String outputTimestamp, org.apache.maven.plugin.logging.Log log, org.apache.maven.project.MavenProject project, java.util.List<org.apache.maven.project.MavenProject> reactorProjects)  
      private boolean isSkip​(org.apache.maven.project.MavenProject project)  
      protected void skip​(org.apache.maven.project.MavenProject last)  
      • 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
    • Field Detail

      • project

        @Component
        protected org.apache.maven.project.MavenProject project
        The Maven project.
      • buildinfoFile

        @Parameter(defaultValue="${project.build.directory}/${project.artifactId}-${project.version}.buildinfo",
                   required=true,
                   readonly=true)
        protected java.io.File buildinfoFile
        Location of the generated buildinfo file.
      • ignoreJavadoc

        @Parameter(property="buildinfo.ignoreJavadoc",
                   defaultValue="true")
        private boolean ignoreJavadoc
        Ignore javadoc attached artifacts from buildinfo generation.
      • ignore

        @Parameter(property="buildinfo.ignore",
                   defaultValue="")
        private java.util.List<java.lang.String> ignore
        Artifacts to ignore, specified as a glob matching against ${groupId}/${filename}, for example */*.xml.
      • detectSkip

        @Parameter(property="buildinfo.detect.skip",
                   defaultValue="true")
        private boolean detectSkip
        Detect projects/modules with install or deploy skipped: avoid taking fingerprints.
      • skipModules

        @Parameter(property="buildinfo.skipModules")
        private java.util.List<java.lang.String> skipModules
        Avoid taking fingerprints for modules specified as glob matching against ${groupId}/${artifactId}.
        Since:
        3.5.0
      • skipModulesMatcher

        private java.util.List<java.nio.file.PathMatcher> skipModulesMatcher
      • reproducible

        @Parameter(property="buildinfo.reproducible",
                   defaultValue="false")
        private boolean reproducible
        Makes the generated .buildinfo file reproducible, by dropping detailed environment recording: OS will be recorded as "Windows" or "Unix", JVM version as major version only.
        Since:
        3.1.0
      • session

        @Component
        protected org.apache.maven.execution.MavenSession session
        The current build session instance. This is used for toolchain manager API calls.
      • outputTimestamp

        @Parameter(defaultValue="${project.build.outputTimestamp}")
        private java.lang.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
      • toolchainManager

        @Component
        private org.apache.maven.toolchain.ToolchainManager toolchainManager
        To obtain a toolchain if possible.
      • artifactHandlerManager

        @Component
        protected org.apache.maven.artifact.handler.manager.ArtifactHandlerManager artifactHandlerManager
      • rtInformation

        @Component
        protected org.apache.maven.rtinfo.RuntimeInformation rtInformation
    • Constructor Detail

      • AbstractBuildinfoMojo

        public AbstractBuildinfoMojo()
    • Method Detail

      • execute

        public void execute()
                     throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • hasBadOutputTimestamp

        static boolean hasBadOutputTimestamp​(java.lang.String outputTimestamp,
                                             org.apache.maven.plugin.logging.Log log,
                                             org.apache.maven.project.MavenProject project,
                                             java.util.List<org.apache.maven.project.MavenProject> reactorProjects)
      • execute

        abstract void execute​(java.util.Map<org.apache.maven.artifact.Artifact,​java.lang.String> artifacts)
                       throws org.apache.maven.plugin.MojoExecutionException
        Execute after buildinfo has been generated for current build (eventually aggregated).
        Parameters:
        artifacts - a Map of artifacts added to the build info with their associated property key prefix (outputs.[#module.].#artifact)
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • skip

        protected void skip​(org.apache.maven.project.MavenProject last)
                     throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • copyAggregateToRoot

        protected void copyAggregateToRoot​(java.io.File aggregate)
                                    throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • generateBuildinfo

        protected java.util.Map<org.apache.maven.artifact.Artifact,​java.lang.String> generateBuildinfo​(boolean mono)
                                                                                                      throws org.apache.maven.plugin.MojoExecutionException
        Generate buildinfo file.
        Parameters:
        mono - is it a mono-module build?
        Returns:
        a Map of artifacts added to the build info with their associated property key prefix (outputs.[#module.].#artifact)
        Throws:
        org.apache.maven.plugin.MojoExecutionException - if anything goes wrong
      • getExecutionRoot

        protected org.apache.maven.project.MavenProject getExecutionRoot()
      • getLastProject

        private org.apache.maven.project.MavenProject getLastProject()
      • isSkip

        private boolean isSkip​(org.apache.maven.project.MavenProject project)
      • getToolchain

        private org.apache.maven.toolchain.Toolchain getToolchain()