You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2023/09/19 16:36:13 UTC

[maven-artifact-plugin] 04/07: [MARTIFACT-47] add compare.fail property

This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-artifact-plugin.git

commit d06a6d6c3dc7c4507cfa518e1513c446062e774d
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Mon Sep 18 08:36:13 2023 +0200

    [MARTIFACT-47] add compare.fail property
---
 .../org/apache/maven/plugins/artifact/buildinfo/CompareMojo.java | 9 ++++++++-
 1 file changed, 8 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..df5f00c 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,13 @@ 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.
+     * @since 3.5.0
+     */
+    @Parameter(property = "compare.fail", defaultValue = "true")
+    private boolean fail;
+
     @Component
     private ArtifactRepositoryLayout artifactRepositoryLayout;
 
@@ -225,7 +232,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");
         }
     }