You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2020/12/30 20:09:34 UTC

[maven] branch MNG-7060 created (now 3cc58e2)

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

rfscholte pushed a change to branch MNG-7060
in repository https://gitbox.apache.org/repos/asf/maven.git.


      at 3cc58e2  [MNG-7060] Let build fail fast in case any maven-gpg-plugin goal is called

This branch includes the following new commits:

     new 3cc58e2  [MNG-7060] Let build fail fast in case any maven-gpg-plugin goal is called

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.



[maven] 01/01: [MNG-7060] Let build fail fast in case any maven-gpg-plugin goal is called

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

rfscholte pushed a commit to branch MNG-7060
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 3cc58e250740dcdcd59dd4a102735050726add6b
Author: rfscholte <rf...@apache.org>
AuthorDate: Wed Dec 30 21:09:24 2020 +0100

    [MNG-7060] Let build fail fast in case any maven-gpg-plugin goal is called
---
 .../maven/lifecycle/internal/builder/BuilderCommon.java | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderCommon.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderCommon.java
index c0cd289..70a97ad 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderCommon.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderCommon.java
@@ -20,8 +20,10 @@ package org.apache.maven.lifecycle.internal.builder;
  */
 
 import java.util.List;
+import java.util.Optional;
 import java.util.Set;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 import javax.inject.Inject;
 import javax.inject.Named;
@@ -80,7 +82,6 @@ public class BuilderCommon
     @Inject
     private Logger logger;
 
-
     public BuilderCommon()
     {
     }
@@ -105,6 +106,20 @@ public class BuilderCommon
 
         lifecycleDebugLogger.debugProjectPlan( project, executionPlan );
 
+        // With Maven 4's build/consumer the POM will always rewrite during distribution.
+        // The maven-gpg-plugin uses the original POM, causing an invalid signature.
+        // Fail as long as there's no solution available yet
+        Optional<MojoExecution> gpgMojo = executionPlan.getMojoExecutions().stream()
+                .filter( m -> "org.apache.maven.plugins".equals( m.getGroupId() ) )
+                .filter( m -> "maven-gpg-plugin".equals( m.getArtifactId() ) )
+                .findAny();
+
+        if ( gpgMojo.isPresent() )
+        {
+            throw new LifecycleExecutionException( "The maven-gpg-plugin is not supported by Maven 4."
+                + " Verify if there is a compatible signing solution or use Maven 3" );
+        }
+
         if ( session.getRequest().getDegreeOfConcurrency() > 1 )
         {
             final Set<Plugin> unsafePlugins = executionPlan.getNonThreadSafePlugins();