khmarbaise commented on a change in pull request #423:
URL: https://github.com/apache/maven/pull/423#discussion_r550322416



##########
File path: 
maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderCommon.java
##########
@@ -105,6 +106,20 @@ public MavenExecutionPlan resolveBuildPlan( MavenSession 
session, MavenProject p
 
         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() )
+        {

Review comment:
       To make more clear the combining of G+A: you could go the path:
   Defining two predicates like:
   ```java
       private Predicate<MojoExecution> isMavenGpgGroupId = m -> 
m.getGroupId().equals( "org.apache.maven.plugins" );
       private Predicate<MojoExecution> isMavenGpgArtifactId = m -> 
m.getArtifactId().equals( "maven-gpg-plugin" );
   ```
   and later use it like this:
   ```java
   boolean gpgMojo = 
executionPlan.getMojoExecutions().stream().anyMatch(isMavenGpgGroupId.and(isMavenGpgArtifactId
 ));
   ```
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to