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/28 06:35:33 UTC
[maven-artifact-plugin] branch MARTIFACT-34 created (now 97ea63a)
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a change to branch MARTIFACT-34
in repository https://gitbox.apache.org/repos/asf/maven-artifact-plugin.git
at 97ea63a [MARTIFACT-34] add nexus-staging skip detection
This branch includes the following new commits:
new 97ea63a [MARTIFACT-34] add nexus-staging skip detection
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-artifact-plugin] 01/01: [MARTIFACT-34] add nexus-staging skip detection
Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a commit to branch MARTIFACT-34
in repository https://gitbox.apache.org/repos/asf/maven-artifact-plugin.git
commit 97ea63a7c44e72bf42ed64462216bf1db231cbf7
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Thu Sep 28 08:35:19 2023 +0200
[MARTIFACT-34] add nexus-staging skip detection
---
.../plugins/artifact/buildinfo/PluginUtil.java | 27 ++++++++++++++++++----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/artifact/buildinfo/PluginUtil.java b/src/main/java/org/apache/maven/plugins/artifact/buildinfo/PluginUtil.java
index 58b126c..74c30b5 100644
--- a/src/main/java/org/apache/maven/plugins/artifact/buildinfo/PluginUtil.java
+++ b/src/main/java/org/apache/maven/plugins/artifact/buildinfo/PluginUtil.java
@@ -25,18 +25,35 @@ import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.xml.Xpp3Dom;
/**
- * Plugin utility to detect if install or deploy is skipped in a build.
+ * Plugin utility to detect if install or deploy is skipped in a build, or even nexus-staging.
+ * It supports both disabling by parameter configuration or property.
+ * Known limitation: it does not look at configuration done more precisely at plugin execution level.
*/
class PluginUtil {
+ private static final String NEXUS_STAGING = "nexus-staging";
+
static boolean isSkip(MavenProject project) {
- return isSkip(project, "install") || isSkip(project, "deploy");
+ return isSkip(project, "install") || isSkip(project, "deploy") || isSkip(project, NEXUS_STAGING);
}
private static boolean isSkip(MavenProject project, String id) {
- Plugin plugin = getPlugin(project, "org.apache.maven.plugins:maven-" + id + "-plugin");
- String skip = getPluginParameter(plugin, "skip");
+ String pluginGa;
+ String pluginParameter;
+ String pluginProperty;
+ if (id.equals(NEXUS_STAGING)) {
+ pluginGa = "org.sonatype.plugins:" + id + "-maven-plugin";
+ pluginParameter = "skipNexusStagingDeployMojo";
+ pluginProperty = "skipNexusStagingDeployMojo";
+ } else {
+ pluginGa = "org.apache.maven.plugins:maven-" + id + "-plugin";
+ pluginParameter = "skip";
+ pluginProperty = "maven." + id + ".skip";
+ }
+
+ Plugin plugin = getPlugin(project, pluginGa);
+ String skip = getPluginParameter(plugin, pluginParameter);
if (skip == null) {
- skip = project.getProperties().getProperty("maven." + id + ".skip");
+ skip = project.getProperties().getProperty(pluginProperty);
}
return Boolean.parseBoolean(skip);
}