The easiest way to opt-in is to configure the plugin in <pluginManagement> of the parent POM, and then only "apply" to chosen projects by declaring the plugin in the <build><plugins> (only needs the groupId and artifactId then)
That only works if you're calling Maven with lifecycle phases though, I think it'll error out if you try to directly invoke the plugin's goals. (I don't know that plugin —or not enough— so can't tell if you're impacted) Le dim. 30 juil. 2023, 20:29, Garret Wilson <gar...@globalmentor.com> a écrit : > I have a "root" POM which I use as the inheritance ancestor of all my > projects: https://github.com/globalmentor/globalmentor-root > > By default it's configured to use the [Nexus Staging Maven > Plugin]( > https://github.com/sonatype/nexus-maven-plugins/blob/main/staging/maven-plugin/README.md). > > It even has a handy `nexus.host` property to define the Nexus server > (because Sonatype actually puts accounts on separate old-school hosts, > but I digress). > > The catch-22 here is that I need this configuration to be turned on for > me to publish this POM to Maven Central, yet there are descendant > projects that use it that I never want to publish to Maven Central. I > don't want this publishing feature turned on by default in child > projects. I would prefer to have a flag that I simply turn on in child > projects (i.e. opt-in) that are to be made public. Any way to have the > Nexus Staging Maven Plugin enabled in the POM itself for publishing to > Maven Central, but have it disabled by default for inherited problems? > > I'm guessing the answer is "no", so let's instead find an easy way to > turn it off. I don't see in the documentation (see link above) that > there's even a "skip" property. Is there? I see that the Maven Deploy > Plugin has such a feature. I also see that there is a > `skipNexusStagingDeployMojo`, but that appears to be neither a > configuration property nor a user property, but only a "plugin flag" > which is "passed in from the CLI" using `-D`. Is there a "skip" > configuration property for the Nexus Staging Maven Plugin ? > > Does anybody know of a better approach for easily disabling publishing > to Maven Central in an inheriting project? > > Garret > > P.S. I'm debating whether this question would be better published on > Stack Overflow, but in my experience it seems that the Maven experts > seem to respond here more than on Stack Overflow. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > >