This is an automated email from the ASF dual-hosted git repository. hboutemy pushed a commit to branch MARTIFACT-47 in repository https://gitbox.apache.org/repos/asf/maven-artifact-plugin.git
commit 2770afa07309510738b8b4df89229f99328adbee Author: Hervé Boutemy <[email protected]> AuthorDate: Mon Sep 18 08:36:13 2023 +0200 [MARTIFACT-47] add compare.fail property --- .../org/apache/maven/plugins/artifact/buildinfo/CompareMojo.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/maven/plugins/artifact/buildinfo/CompareMojo.java b/src/main/java/org/apache/maven/plugins/artifact/buildinfo/CompareMojo.java index 156e2d0..c4ed2d5 100644 --- a/src/main/java/org/apache/maven/plugins/artifact/buildinfo/CompareMojo.java +++ b/src/main/java/org/apache/maven/plugins/artifact/buildinfo/CompareMojo.java @@ -95,6 +95,12 @@ public class CompareMojo extends AbstractBuildinfoMojo { @Parameter(defaultValue = "${project.remoteProjectRepositories}", readonly = true) private List<RemoteRepository> remoteRepos; + /** + * Fail the build if differences are found against reference build. + */ + @Parameter(property = "compare.fail", defaultValue = "true") + private boolean fail; + @Component private ArtifactRepositoryLayout artifactRepositoryLayout; @@ -225,7 +231,7 @@ public class CompareMojo extends AbstractBuildinfoMojo { copyAggregateToRoot(buildcompare); - if (ko + missing > 0) { + if (fail && (ko + missing > 0)) { throw new MojoExecutionException("Build artifacts are different from reference"); } }
