gnodet commented on code in PR #413:
URL: https://github.com/apache/maven-archiver/pull/413#discussion_r4144699460
##########
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:
It's a developer choice in configuration — there's no automatic override.
The developer adds `central-publishing-maven-plugin` and typically also sets
`<skip>true</skip>` on `maven-deploy-plugin` (or sets the `maven.deploy.skip`
property).
The priority-based approach avoids the need to check `<skip>` on the *other*
plugins to figure out which one is "active." The presence of
`central-publishing-maven-plugin` in the POM is itself the signal that the
developer chose it as the deployment mechanism. Checking the deploy plugin's
skip status would be fragile: in many parent POMs, the deploy plugin is
inherited without explicit skip configuration, and checking it would
incorrectly report the module as deployable-via-deploy-plugin when the
developer intended central-publishing.
So the logic is: "which plugin *owns* deployment?" rather than "which
plugins are not skipped?" — and the priority order reflects the real-world
deployment hierarchy.
--
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]