You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2023/02/03 14:19:44 UTC

[maven-artifact-plugin] branch MARTIFACT-35 updated (91ad338 -> 2a90238)

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

michaelo pushed a change to branch MARTIFACT-35
in repository https://gitbox.apache.org/repos/asf/maven-artifact-plugin.git


 discard 91ad338  [MARTIFACT-35] Compare goal should fail build when comparison was unsuccessful
     new 2a90238  [MARTIFACT-35] Compare goal should fail build when comparison was unsuccessful

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (91ad338)
            \
             N -- N -- N   refs/heads/MARTIFACT-35 (2a90238)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/maven/plugins/artifact/buildinfo/CompareMojo.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


[maven-artifact-plugin] 01/01: [MARTIFACT-35] Compare goal should fail build when comparison was unsuccessful

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 2a902388cd9314c9b2bd74a522bbb2641e40bcec
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Thu Feb 2 10:42:51 2023 +0100

    [MARTIFACT-35] Compare goal should fail build when comparison was unsuccessful
    
    This closes #12
---
 src/it/compare-mono/invoker.properties                  |  1 +
 .../maven/plugins/artifact/buildinfo/CompareMojo.java   | 17 +++++++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/it/compare-mono/invoker.properties b/src/it/compare-mono/invoker.properties
index 339a145..fe14eb3 100644
--- a/src/it/compare-mono/invoker.properties
+++ b/src/it/compare-mono/invoker.properties
@@ -17,3 +17,4 @@
 
 invoker.goals.1=clean install
 invoker.goals.2=clean package artifact:compare
+invoker.buildResult.2=failure
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 a6b2e6d..3414471 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
@@ -192,12 +192,12 @@ public class CompareMojo
 
         if ( ko + missing > 0 )
         {
-            getLog().warn( "Reproducible Build output summary: " + MessageUtils.buffer().success( ok + " files ok" )
+            getLog().error( "Reproducible Build output summary: " + MessageUtils.buffer().success( ok + " files ok" )
                 + ", " + MessageUtils.buffer().failure( ko + " different" )
-                + ( ( missing == 0 ) ? "" : ( ", " + MessageUtils.buffer().warning( missing + " missing" ) ) ) );
-            getLog().warn( "see " + MessageUtils.buffer().project( "diff " + relative( referenceBuildinfo ) + " "
+                + ( ( missing == 0 ) ? "" : ( ", " + MessageUtils.buffer().failure( missing + " missing" ) ) ) );
+            getLog().error( "see " + MessageUtils.buffer().project( "diff " + relative( referenceBuildinfo ) + " "
                 + relative( buildinfoFile ) ).toString() );
-            getLog().warn( "see also https://maven.apache.org/guides/mini/guide-reproducible-builds.html" );
+            getLog().error( "see also https://maven.apache.org/guides/mini/guide-reproducible-builds.html" );
           }
         else
         {
@@ -241,6 +241,11 @@ public class CompareMojo
         }
 
         copyAggregateToRoot( buildcompare );
+
+        if ( ko + missing > 0 )
+        {
+            throw new MojoExecutionException( "Build artifacts are different from reference" );
+        }
     }
 
     // { filename, diffoscope }
@@ -268,8 +273,8 @@ public class CompareMojo
         if ( issue != null )
         {
             String diffoscope = diffoscope( artifact, referenceDir );
-            getLog().warn( issue + " mismatch " + MessageUtils.buffer().strong( actualFilename ) + ": investigate with "
-                + MessageUtils.buffer().project( diffoscope ) );
+            getLog().error( issue + " mismatch " + MessageUtils.buffer().strong( actualFilename )
+                + ": investigate with " + MessageUtils.buffer().project( diffoscope ) );
             return new String[] { actualFilename,  diffoscope };
         }
         return new String[] { actualFilename, null };