gnodet commented on code in PR #413:
URL: https://github.com/apache/maven-archiver/pull/413#discussion_r4144634443
##########
src/main/java/org/apache/maven/shared/archiver/BuildHelper.java:
##########
@@ -109,12 +116,94 @@ public static String getPluginParameter(Model model,
Plugin plugin, String param
return value;
}
+ /**
+ * Determines whether a Maven module will be deployed to a remote
repository.
+ * <p>
+ * This method analyses the model's plugin configuration to detect if
deployment will be skipped,
+ * taking into account the three known deployment mechanisms:
+ * <ol>
+ * <li>{@code central-publishing-maven-plugin} — the new Sonatype Central
Portal publisher; when
+ * present it replaces {@code maven-deploy-plugin}. The module is
considered deployable if the
+ * plugin has at least one execution of the {@code publish} goal that
is not skipped (via the
+ * {@code skipPublishing} parameter or property).</li>
+ * <li>{@code nexus-staging-maven-plugin} — the legacy Sonatype OSS
publisher; when present it
+ * replaces standard deploy. The module is considered deployable if it
has at least one execution
+ * of the {@code deploy} goal that is not skipped (via the {@code
skipNexusStagingDeployMojo}
+ * parameter or property).</li>
+ * <li>{@code maven-deploy-plugin} — the standard deploy plugin. The
module is deployable if it has
+ * at least one execution of the {@code deploy} goal that is not
skipped (via the {@code skip}
+ * parameter or the {@code maven.deploy.skip} property).</li>
+ * </ol>
+ * The extension plugins are checked first. If neither is present, the
standard deploy plugin is
+ * checked. A module with none of these plugins configured is considered
deployable by default.
+ *
+ * @param model the effective (fully-resolved) project model, not null
+ * @return {@code true} if the module will be deployed to a remote
repository, {@code false} otherwise
+ * @since 4.0.0-beta-6
+ */
+ public static boolean isDeployable(Model model) {
+ Plugin centralPublishing = getPlugin(model, CENTRAL_PUBLISHING_PLUGIN);
+ if (centralPublishing != null) {
Review Comment:
The priority-based approach reflects how these plugins work in practice:
they are mutually exclusive deployment mechanisms. When a project uses
`central-publishing-maven-plugin`, it explicitly disables `maven-deploy-plugin`
with `<skip>true</skip>` (or removes its executions entirely). In that setup,
checking the deploy plugin would incorrectly report the module as
non-deployable, even though it *is* being deployed via central-publishing.
The same pattern applies to `nexus-staging-maven-plugin`: it takes over the
deploy lifecycle and the standard plugin is typically disabled.
So the logic mirrors the actual deployment pipeline: whichever plugin *owns*
deployment is the one that matters. If we checked whether *any* plugin says
deployable, we'd get false positives from disabled fallback plugins that are
still declared in the POM (common in parent POMs). The priority order ensures
we ask the right plugin.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]