gnodet commented on code in PR #413:
URL: https://github.com/apache/maven-archiver/pull/413#discussion_r4144349454
##########
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:
Yes, that can happen — e.g. `central-publishing-maven-plugin` alongside
`maven-deploy-plugin` with `<skip>true</skip>` (which is a common setup to
disable the standard deploy when central-publishing takes over).
The method uses a priority-based approach: it evaluates only the first
matching plugin in the order central-publishing → nexus-staging →
maven-deploy-plugin. When an extension plugin is present, it is assumed to own
the deployment lifecycle and the others are ignored.
I've updated the Javadoc in 525ce9e to make this precedence explicit: *"Only
the first matching plugin is evaluated: if central-publishing-maven-plugin is
present, the other two are ignored regardless of their configuration."*
The existing test
`isDeployableWithCentralPublishingTakesPrecedenceOverDeployPlugin` covers
exactly this scenario.
--
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]