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
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 Summary
FieldsModifier and TypeFieldDescriptionprivate booleanCompare aggregate only (ie wait for the last module) or also compare on each module.private org.apache.maven.artifact.factory.ArtifactFactoryprivate org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayoutprivate booleanFail the build if differences are found against reference build.private StringRepository for reference build, containing either reference buildinfo file or reference artifacts.
Format:idorurlorid::urlid The repository id url The url of the repositoryprivate List<org.eclipse.aether.repository.RemoteRepository> The project's remote repositories to use for the resolution.private org.eclipse.aether.RepositorySystemSessionThe current repository/network configuration of Maven.private org.eclipse.aether.RepositorySystemThe entry point to Maven Artifact Resolver, i.e.Fields inherited from class org.apache.maven.plugins.artifact.buildinfo.AbstractBuildinfoMojo
artifactHandlerManager, buildinfoFile, project, rtInformation, sessionFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcheckAgainstReference(Map<org.apache.maven.artifact.Artifact, String> artifacts, boolean mono) Check current build result with reference.private String[]checkArtifact(org.apache.maven.artifact.Artifact artifact, String prefix, Properties reference, Properties actual, File referenceDir) private voidcompareWithReference(Map<org.apache.maven.artifact.Artifact, String> artifacts, File referenceBuildinfo) private static org.eclipse.aether.repository.RemoteRepositoryprivate org.eclipse.aether.repository.RemoteRepositoryprivate Stringdiffoscope(org.apache.maven.artifact.Artifact a, File referenceDir) private FiledownloadOrCreateReferenceBuildinfo(boolean mono, Map<org.apache.maven.artifact.Artifact, String> artifacts, File referenceDir) voidExecute after buildinfo has been generated for current build (eventually aggregated).private static StringfindPrefix(Properties reference, String actualGroupId, String actualFilename) private StringgetRepositoryFilename(org.apache.maven.artifact.Artifact a) private Stringprotected voidskip(org.apache.maven.project.MavenProject last) Methods inherited from class org.apache.maven.plugins.artifact.buildinfo.AbstractBuildinfoMojo
copyAggregateToRoot, execute, generateBuildinfo, getExecutionRoot, hasBadOutputTimestampMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
referenceRepo
Repository 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:
-
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 repoSystemThe 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 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
-
-
Constructor Details
-
CompareMojo
public CompareMojo()
-
-
Method Details
-
execute
public void execute(Map<org.apache.maven.artifact.Artifact, 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(Map<org.apache.maven.artifact.Artifact, 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 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
-
getRepositoryFilename
-
relative
-
findPrefix
-
createReferenceRepo
private org.eclipse.aether.repository.RemoteRepository createReferenceRepo() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
createDeploymentArtifactRepository
-