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 AbstractBuildinfoMojoCompare current build output (frompackage) against reference either previouslyinstall-ed or downloaded from a remote repository: comparison results go to.buildcomparefile.- Since:
- 3.2.0
-
-
Field Summary
Fields Modifier and Type Field Description private booleanaggregateOnlyCompare aggregate only (ie wait for the last module) or also compare on each module.private org.apache.maven.artifact.factory.ArtifactFactoryartifactFactoryprivate org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayoutartifactRepositoryLayoutprivate booleanfailFail the build if differences are found against reference build.private java.lang.StringreferenceRepoRepository for reference build, containing either reference buildinfo file or reference artifacts.
Format:idorurlorid::urlid The repository id url The url of the repositoryprivate java.util.List<org.eclipse.aether.repository.RemoteRepository>remoteReposThe project's remote repositories to use for the resolution.private org.eclipse.aether.RepositorySystemSessionrepoSessionThe current repository/network configuration of Maven.private org.eclipse.aether.RepositorySystemrepoSystemThe entry point to Maven Artifact Resolver, i.e.-
Fields inherited from class org.apache.maven.plugins.artifact.buildinfo.AbstractBuildinfoMojo
artifactHandlerManager, buildinfoFile, project, rtInformation, session
-
-
Constructor Summary
Constructors Constructor Description CompareMojo()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcheckAgainstReference(java.util.Map<org.apache.maven.artifact.Artifact,java.lang.String> artifacts, boolean mono)Check current build result with reference.private java.lang.String[]checkArtifact(org.apache.maven.artifact.Artifact artifact, java.lang.String prefix, java.util.Properties reference, java.util.Properties actual, java.io.File referenceDir)private voidcompareWithReference(java.util.Map<org.apache.maven.artifact.Artifact,java.lang.String> artifacts, java.io.File referenceBuildinfo)private static org.eclipse.aether.repository.RemoteRepositorycreateDeploymentArtifactRepository(java.lang.String id, java.lang.String url)private org.eclipse.aether.repository.RemoteRepositorycreateReferenceRepo()private java.lang.Stringdiffoscope(org.apache.maven.artifact.Artifact a, java.io.File referenceDir)private java.io.FiledownloadOrCreateReferenceBuildinfo(boolean mono, java.util.Map<org.apache.maven.artifact.Artifact,java.lang.String> artifacts, java.io.File referenceDir)voidexecute(java.util.Map<org.apache.maven.artifact.Artifact,java.lang.String> artifacts)Execute after buildinfo has been generated for current build (eventually aggregated).private static java.lang.StringfindPrefix(java.util.Properties reference, java.lang.String actualGroupId, java.lang.String actualFilename)private java.lang.StringgetRepositoryFilename(org.apache.maven.artifact.Artifact a)private java.lang.Stringrelative(java.io.File file)protected voidskip(org.apache.maven.project.MavenProject last)-
Methods inherited from class org.apache.maven.plugins.artifact.buildinfo.AbstractBuildinfoMojo
copyAggregateToRoot, execute, generateBuildinfo, getExecutionRoot, hasBadOutputTimestamp
-
-
-
-
Field Detail
-
referenceRepo
@Parameter(property="reference.repo", defaultValue="central") private java.lang.String referenceRepoRepository for reference build, containing either reference buildinfo file or reference artifacts.
Format:idorurlorid::url- id
- The repository id
- url
- The url of the repository
- See Also:
- repository definition
-
aggregateOnly
@Parameter(property="compare.aggregate.only", defaultValue="false") private boolean aggregateOnlyCompare 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 repoSessionThe current repository/network configuration of Maven.
-
remoteRepos
@Parameter(defaultValue="${project.remoteProjectRepositories}", readonly=true) private java.util.List<org.eclipse.aether.repository.RemoteRepository> remoteReposThe project's remote repositories to use for the resolution.
-
fail
@Parameter(property="compare.fail", defaultValue="true") private boolean failFail the build if differences are found against reference build.- Since:
- 3.5.0
-
artifactRepositoryLayout
@Component private org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout artifactRepositoryLayout
-
-
Method Detail
-
execute
public void execute(java.util.Map<org.apache.maven.artifact.Artifact,java.lang.String> artifacts) throws org.apache.maven.plugin.MojoExecutionExceptionDescription copied from class:AbstractBuildinfoMojoExecute after buildinfo has been generated for current build (eventually aggregated).- Specified by:
executein classAbstractBuildinfoMojo- 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:
skipin classAbstractBuildinfoMojo- Throws:
org.apache.maven.plugin.MojoExecutionException
-
checkAgainstReference
private void checkAgainstReference(java.util.Map<org.apache.maven.artifact.Artifact,java.lang.String> artifacts, boolean mono) throws org.apache.maven.plugin.MojoExecutionExceptionCheck 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 java.io.File downloadOrCreateReferenceBuildinfo(boolean mono, java.util.Map<org.apache.maven.artifact.Artifact,java.lang.String> artifacts, java.io.File referenceDir) throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
compareWithReference
private void compareWithReference(java.util.Map<org.apache.maven.artifact.Artifact,java.lang.String> artifacts, java.io.File referenceBuildinfo) throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
checkArtifact
private java.lang.String[] checkArtifact(org.apache.maven.artifact.Artifact artifact, java.lang.String prefix, java.util.Properties reference, java.util.Properties actual, java.io.File referenceDir)
-
diffoscope
private java.lang.String diffoscope(org.apache.maven.artifact.Artifact a, java.io.File referenceDir)
-
getRepositoryFilename
private java.lang.String getRepositoryFilename(org.apache.maven.artifact.Artifact a)
-
relative
private java.lang.String relative(java.io.File file)
-
findPrefix
private static java.lang.String findPrefix(java.util.Properties reference, java.lang.String actualGroupId, java.lang.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(java.lang.String id, java.lang.String url)
-
-