Class CompareMojo

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

@Mojo(name="compare", threadSafe=true) public class CompareMojo extends AbstractBuildinfoMojo
Compare current build output (from package) against reference either previously install-ed or downloaded from a remote repository: comparison results go to .buildcompare file.
Since:
3.2.0
  • Field Details

    • referenceRepo

      @Parameter(property="reference.repo", defaultValue="central") private String referenceRepo
      Repository for reference build, containing either reference buildinfo file or reference artifacts.
      Format: id or url or id::url
      id
      The repository id
      url
      The url of the repository
      See Also:
    • aggregateOnly

      @Parameter(property="compare.aggregate.only", defaultValue="false") private boolean aggregateOnly
      Compare aggregate only (ie wait for the last module) or also compare on each module.
      Since:
      3.2.0
    • artifactFactory

      @Component private org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
    • repoSystem

      @Component private org.eclipse.aether.RepositorySystem repoSystem
      The entry point to Maven Artifact Resolver, i.e. the component doing all the work.
    • repoSession

      @Parameter(defaultValue="${repositorySystemSession}", readonly=true) private org.eclipse.aether.RepositorySystemSession repoSession
      The current repository/network configuration of Maven.
    • remoteRepos

      @Parameter(defaultValue="${project.remoteProjectRepositories}", readonly=true) private List<org.eclipse.aether.repository.RemoteRepository> remoteRepos
      The project's remote repositories to use for the resolution.
    • fail

      @Parameter(property="compare.fail", defaultValue="true") private boolean fail
      Fail the build if differences are found against reference build.
      Since:
      3.5.0
    • artifactRepositoryLayout

      @Component private org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout artifactRepositoryLayout
  • Constructor Details

    • CompareMojo

      public CompareMojo()
  • Method Details

    • execute

      public void execute(Map<org.apache.maven.artifact.Artifact,String> artifacts) throws org.apache.maven.plugin.MojoExecutionException
      Description copied from class: AbstractBuildinfoMojo
      Execute after buildinfo has been generated for current build (eventually aggregated).
      Specified by:
      execute in class AbstractBuildinfoMojo
      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
      Overrides:
      skip in class AbstractBuildinfoMojo
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • checkAgainstReference

      private void checkAgainstReference(Map<org.apache.maven.artifact.Artifact,String> artifacts, boolean mono) throws org.apache.maven.plugin.MojoExecutionException
      Check current build result with reference.
      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 - if anything goes wrong
    • downloadOrCreateReferenceBuildinfo

      private File downloadOrCreateReferenceBuildinfo(boolean mono, Map<org.apache.maven.artifact.Artifact,String> artifacts, File referenceDir) throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • compareWithReference

      private void compareWithReference(Map<org.apache.maven.artifact.Artifact,String> artifacts, File referenceBuildinfo) throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • checkArtifact

      private String[] checkArtifact(org.apache.maven.artifact.Artifact artifact, String prefix, Properties reference, Properties actual, File referenceDir)
    • diffoscope

      private String diffoscope(org.apache.maven.artifact.Artifact a, File referenceDir)
    • getRepositoryFilename

      private String getRepositoryFilename(org.apache.maven.artifact.Artifact a)
    • relative

      private String relative(File file)
    • findPrefix

      private static String findPrefix(Properties reference, String actualGroupId, String actualFilename)
    • createReferenceRepo

      private org.eclipse.aether.repository.RemoteRepository createReferenceRepo() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • createDeploymentArtifactRepository

      private static org.eclipse.aether.repository.RemoteRepository createDeploymentArtifactRepository(String id, String url)