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/02 09:19:53 UTC
[maven-artifact-plugin] branch MARTIFACT-38 updated: Make failure configurable
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch MARTIFACT-38
in repository https://gitbox.apache.org/repos/asf/maven-artifact-plugin.git
The following commit(s) were added to refs/heads/MARTIFACT-38 by this push:
new 019ce64 Make failure configurable
019ce64 is described below
commit 019ce645fa3416c1e1658fd7bfdf031e5a5c1c66
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Thu Feb 2 10:19:45 2023 +0100
Make failure configurable
---
.../artifact/buildinfo/CheckBuildPlanMojo.java | 37 ++++++++++++++++++++--
1 file changed, 34 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/artifact/buildinfo/CheckBuildPlanMojo.java b/src/main/java/org/apache/maven/plugins/artifact/buildinfo/CheckBuildPlanMojo.java
index c609fef..e9dfee5 100644
--- a/src/main/java/org/apache/maven/plugins/artifact/buildinfo/CheckBuildPlanMojo.java
+++ b/src/main/java/org/apache/maven/plugins/artifact/buildinfo/CheckBuildPlanMojo.java
@@ -85,6 +85,12 @@ public class CheckBuildPlanMojo
@Parameter( property = "check.plugin-issues" )
private File pluginIssues;
+ /**
+ * Make build fail if execution plan contains non-reproducible plugins.
+ */
+ @Parameter( property = "check.failOnNonReproducible", defaultValue = "true" )
+ private boolean failOnNonReproducible;
+
protected MavenExecutionPlan calculateExecutionPlan()
throws MojoExecutionException
{
@@ -125,8 +131,17 @@ public class CheckBuildPlanMojo
}
else if ( issue.startsWith( "fail:" ) )
{
- getLog().error( "plugin without solution " + id + ", see " + issue.substring( 5 ) );
+ String logMessage = "plugin without solution " + id + ", see " + issue.substring( 5 );
+ if ( failOnNonReproducible )
+ {
+ getLog().error( logMessage );
+ }
+ else
+ {
+ getLog().warn( logMessage );
+ }
fail = true;
+
}
else
{
@@ -134,7 +149,15 @@ public class CheckBuildPlanMojo
ArtifactVersion version = new DefaultArtifactVersion( plugin.getVersion() );
if ( version.compareTo( minimum ) < 0 )
{
- getLog().error( "plugin with non-reproducible output: " + id + ", require minimum " + issue );
+ String logMessage = "plugin with non-reproducible output: " + id + ", require minimum " + issue;
+ if ( failOnNonReproducible )
+ {
+ getLog().error( logMessage );
+ }
+ else
+ {
+ getLog().warn( logMessage );
+ }
fail = true;
}
else
@@ -158,7 +181,15 @@ public class CheckBuildPlanMojo
}
getLog().info( " parent pom.xml is " + parent.getBasedir() + "/pom.xml" );
}
- throw new MojoExecutionException( "non-reproducible plugin or configuration found with fix available" );
+ String message = "non-reproducible plugin or configuration found with fix available";
+ if ( failOnNonReproducible )
+ {
+ throw new MojoExecutionException( message );
+ }
+ else
+ {
+ getLog().warn( message );
+ }
}
}