Class AbstractBuildinfoMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.maven.plugins.artifact.buildinfo.AbstractBuildinfoMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
BuildinfoMojo, CompareMojo, DescribeBuildOutputMojo

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 File
    Location of the generated buildinfo file.
    protected String
    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 final org.apache.maven.project.MavenProject
    The Maven project.
    protected final org.apache.maven.rtinfo.RuntimeInformation
     
    protected final org.apache.maven.execution.MavenSession
    The current build session instance.

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

    ROLE
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractBuildinfoMojo(org.apache.maven.toolchain.ToolchainManager toolchainManager, org.apache.maven.rtinfo.RuntimeInformation rtInformation, org.apache.maven.project.MavenProject project, org.apache.maven.execution.MavenSession session)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected File
     
    void
     
    protected Map<org.eclipse.aether.artifact.Artifact,String>
    generateBuildinfo(boolean mono)
    Generate buildinfo file.
    protected org.apache.maven.project.MavenProject
     
    protected boolean
    isSkip(org.apache.maven.project.MavenProject project)
     
    protected boolean
    isSkipModule(org.apache.maven.project.MavenProject project)
     
    protected org.apache.maven.plugins.artifact.buildinfo.BuildInfoWriter
    newBuildInfoWriter(PrintWriter p, boolean mono)
     
    protected String
    relative(File file)
     
    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 Details

    • buildinfoFile

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

      @Parameter(defaultValue="${project.build.outputTimestamp}") 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).
      Since:
      3.2.0
    • rtInformation

      protected final org.apache.maven.rtinfo.RuntimeInformation rtInformation
    • project

      protected final org.apache.maven.project.MavenProject project
      The Maven project.
    • session

      protected final org.apache.maven.execution.MavenSession session
      The current build session instance. This is used for toolchain manager API calls.
  • Constructor Details

    • AbstractBuildinfoMojo

      protected AbstractBuildinfoMojo(org.apache.maven.toolchain.ToolchainManager toolchainManager, org.apache.maven.rtinfo.RuntimeInformation rtInformation, org.apache.maven.project.MavenProject project, org.apache.maven.execution.MavenSession session)
  • Method Details

    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException
      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 File copyAggregateToRoot(File aggregate) throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • newBuildInfoWriter

      protected org.apache.maven.plugins.artifact.buildinfo.BuildInfoWriter newBuildInfoWriter(PrintWriter p, boolean mono)
    • generateBuildinfo

      protected Map<org.eclipse.aether.artifact.Artifact,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
    • getLastProject

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

      protected boolean isSkip(org.apache.maven.project.MavenProject project)
    • isSkipModule

      protected boolean isSkipModule(org.apache.maven.project.MavenProject project)
    • relative

      protected String relative(File file)