Skip to content

Commit 73c17c3

Browse files
committed
[MARTIFACT-34] add nexus-staging skip detection
1 parent 0acc794 commit 73c17c3

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

src/main/java/org/apache/maven/plugins/artifact/buildinfo/PluginUtil.java

+22-5
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,35 @@
2525
import org.codehaus.plexus.util.xml.Xpp3Dom;
2626

2727
/**
28-
* Plugin utility to detect if install or deploy is skipped in a build.
28+
* Plugin utility to detect if install or deploy is skipped in a build, or even nexus-staging.
29+
* It supports both disabling by parameter configuration or property.
30+
* Known limitation: it does not look at configuration done more precisely at plugin execution level.
2931
*/
3032
class PluginUtil {
33+
private static final String NEXUS_STAGING = "nexus-staging";
34+
3135
static boolean isSkip(MavenProject project) {
32-
return isSkip(project, "install") || isSkip(project, "deploy");
36+
return isSkip(project, "install") || isSkip(project, "deploy") || isSkip(project, NEXUS_STAGING);
3337
}
3438

3539
private static boolean isSkip(MavenProject project, String id) {
36-
Plugin plugin = getPlugin(project, "org.apache.maven.plugins:maven-" + id + "-plugin");
37-
String skip = getPluginParameter(plugin, "skip");
40+
String pluginGa;
41+
String pluginParameter;
42+
String pluginProperty;
43+
if (id.equals(NEXUS_STAGING)) {
44+
pluginGa = "org.sonatype.plugins:" + id + "-maven-plugin";
45+
pluginParameter = "skipNexusStagingDeployMojo";
46+
pluginProperty = "skipNexusStagingDeployMojo";
47+
} else {
48+
pluginGa = "org.apache.maven.plugins:maven-" + id + "-plugin";
49+
pluginParameter = "skip";
50+
pluginProperty = "maven." + id + ".skip";
51+
}
52+
53+
Plugin plugin = getPlugin(project, pluginGa);
54+
String skip = getPluginParameter(plugin, pluginParameter);
3855
if (skip == null) {
39-
skip = project.getProperties().getProperty("maven." + id + ".skip");
56+
skip = project.getProperties().getProperty(pluginProperty);
4057
}
4158
return Boolean.parseBoolean(skip);
4259
}

0 commit comments

Comments
 (0)