This is an automated email from the ASF dual-hosted git repository. hboutemy pushed a commit to branch deploy in repository https://gitbox.apache.org/repos/asf/maven-studies.git
commit 87da7d34c287bec6487bbdee4e83d8710eab1b84 Author: Hervé Boutemy <[email protected]> AuthorDate: Sun Oct 5 10:40:54 2025 +0200 add nxrm3 option --- 1.7_DISCOVERY-nxrm3-staging.md | 267 +++++++++++++++++++++++++++++++++++++++++ README.md | 4 +- pom.xml | 49 ++++++++ 3 files changed, 318 insertions(+), 2 deletions(-) diff --git a/1.7_DISCOVERY-nxrm3-staging.md b/1.7_DISCOVERY-nxrm3-staging.md new file mode 100644 index 000000000..2a6574b05 --- /dev/null +++ b/1.7_DISCOVERY-nxrm3-staging.md @@ -0,0 +1,267 @@ +# deploy with Sonatype nxrm3 Maven plugin + +TBD: as of October 2025, this is a WIP for ASF's [Apache Trusted Release](https://github.com/apache/tooling-trusted-release) staging process during vote, +using replacement [Nexus Repository 3 platform](https://repository.apache.org:4443/) and associated [nxrm3 Maven plugin](https://central.sonatype.com/artifact/org.sonatype.plugins/nxrm3-maven-plugin) + +https://help.sonatype.com/en/nexus-repository-maven-plugin.html + + mvn clean deploy -Pasf-nxrm3 + +with `rao3` server id defined in `~/.m2/settings.xml` for putting credentials, same as `apache.releases.https`from [existing setup for releases staging](https://infra.apache.org/publishing-maven-artifacts.html). + +Running with this plugin completely removes the `maven-deploy-plugin` from the build execution (as if it was not inherited from parent POM...), replacing with `central-publishing:publish`. + +<details><summary>mvn clean deploy -Pasf-nxrm3</summary> + +``` +$ mvn clean deploy -Pasf-nxrm3 +[INFO] Scanning for projects... +[INFO] Njord 0.8.2 session created +[INFO] ------------------------------------------------------------------------ +[INFO] Reactor Build Order: +[INFO] +[INFO] deploy study root [pom] +[INFO] sub projects [pom] +[INFO] logging [jar] +[INFO] core project classes [jar] +[INFO] enterprise java beans [ejb] +[INFO] servlet [war] +[INFO] ear assembly [ear] +[INFO] +[INFO] ------------------< org.apache.maven.studies:deploy >------------------- +[INFO] Building deploy study root 1.0 [1/7] +[INFO] from pom.xml +[INFO] --------------------------------[ pom ]--------------------------------- +[INFO] +[INFO] --- clean:3.5.0:clean (default-clean) @ deploy --- +[INFO] Deleting /home/herve/dev/maven/sources/studies/deploy/target +[INFO] +[INFO] --- install:3.1.4:install (default-install) @ deploy --- +[INFO] Installing /home/herve/dev/maven/sources/studies/deploy/pom.xml to /home/herve/.m2/repository/org/apache/maven/studies/deploy/1.0/deploy-1.0.pom +[INFO] +[INFO] --- nxrm3:1.0.12:deploy (default-deploy) @ deploy --- +[INFO] Pom project to deploy, deploying with attached artifacts. +[INFO] No tag was provided; using generated tag 'deploy-1.0-1759652819873' +[INFO] Creating tag deploy-1.0-1759652819873 as it does not already exist +[INFO] Saving staging information to /home/herve/dev/maven/sources/studies/deploy/target/nexus-staging/staging/staging.properties +[INFO] Deploying to repository 'maven-staging' with tag 'deploy-1.0-1759652819873' +[INFO] +[INFO] -----------------< org.apache.maven.studies:projects >------------------ +[INFO] Building sub projects 1.0 [2/7] +[INFO] from projects/pom.xml +[INFO] --------------------------------[ pom ]--------------------------------- +[INFO] +[INFO] --- clean:3.5.0:clean (default-clean) @ projects --- +[INFO] +[INFO] --- install:3.1.4:install (default-install) @ projects --- +[INFO] Installing /home/herve/dev/maven/sources/studies/deploy/projects/pom.xml to /home/herve/.m2/repository/org/apache/maven/studies/projects/1.0/projects-1.0.pom +[INFO] +[INFO] --- nxrm3:1.0.12:deploy (default-deploy) @ projects --- +[INFO] Pom project to deploy, deploying with attached artifacts. +[INFO] Tag deploy-1.0-1759652819873 already exists, skipping creation +[INFO] Saving staging information to /home/herve/dev/maven/sources/studies/deploy/target/nexus-staging/staging/staging.properties +[INFO] Deploying to repository 'maven-staging' with tag 'deploy-1.0-1759652819873' +[INFO] +[INFO] ------------------< org.apache.maven.studies:logging >------------------ +[INFO] Building logging 1.0 [3/7] +[INFO] from projects/logging/pom.xml +[INFO] --------------------------------[ jar ]--------------------------------- +[INFO] +[INFO] --- clean:3.5.0:clean (default-clean) @ logging --- +[INFO] Deleting /home/herve/dev/maven/sources/studies/deploy/projects/logging/target +[INFO] +[INFO] --- resources:3.3.1:resources (default-resources) @ logging --- +[INFO] skip non existing resourceDirectory /home/herve/dev/maven/sources/studies/deploy/projects/logging/src/main/resources +[INFO] +[INFO] --- compiler:3.14.0:compile (default-compile) @ logging --- +[INFO] No sources to compile +[INFO] +[INFO] --- resources:3.3.1:testResources (default-testResources) @ logging --- +[INFO] skip non existing resourceDirectory /home/herve/dev/maven/sources/studies/deploy/projects/logging/src/test/resources +[INFO] +[INFO] --- compiler:3.14.0:testCompile (default-testCompile) @ logging --- +[INFO] No sources to compile +[INFO] +[INFO] --- surefire:3.5.3:test (default-test) @ logging --- +[INFO] No tests to run. +[INFO] +[INFO] --- jar:3.4.2:jar (default-jar) @ logging --- +[WARNING] JAR will be empty - no content was marked for inclusion! +[INFO] Building jar: /home/herve/dev/maven/sources/studies/deploy/projects/logging/target/logging-1.0.jar +[INFO] +[INFO] --- install:3.1.4:install (default-install) @ logging --- +[INFO] Installing /home/herve/dev/maven/sources/studies/deploy/projects/logging/pom.xml to /home/herve/.m2/repository/org/apache/maven/studies/logging/1.0/logging-1.0.pom +[INFO] Installing /home/herve/dev/maven/sources/studies/deploy/projects/logging/target/logging-1.0.jar to /home/herve/.m2/repository/org/apache/maven/studies/logging/1.0/logging-1.0.jar +[INFO] +[INFO] --- nxrm3:1.0.12:deploy (default-deploy) @ logging --- +[INFO] Tag deploy-1.0-1759652819873 already exists, skipping creation +[INFO] Saving staging information to /home/herve/dev/maven/sources/studies/deploy/target/nexus-staging/staging/staging.properties +[INFO] Deploying to repository 'maven-staging' with tag 'deploy-1.0-1759652819873' +[INFO] +[INFO] --------------< org.apache.maven.studies:primary-source >--------------- +[INFO] Building core project classes 1.0 [4/7] +[INFO] from projects/primary-source/pom.xml +[INFO] --------------------------------[ jar ]--------------------------------- +[INFO] +[INFO] --- clean:3.5.0:clean (default-clean) @ primary-source --- +[INFO] Deleting /home/herve/dev/maven/sources/studies/deploy/projects/primary-source/target +[INFO] +[INFO] --- resources:3.3.1:resources (default-resources) @ primary-source --- +[INFO] skip non existing resourceDirectory /home/herve/dev/maven/sources/studies/deploy/projects/primary-source/src/main/resources +[INFO] +[INFO] --- compiler:3.14.0:compile (default-compile) @ primary-source --- +[INFO] No sources to compile +[INFO] +[INFO] --- resources:3.3.1:testResources (default-testResources) @ primary-source --- +[INFO] skip non existing resourceDirectory /home/herve/dev/maven/sources/studies/deploy/projects/primary-source/src/test/resources +[INFO] +[INFO] --- compiler:3.14.0:testCompile (default-testCompile) @ primary-source --- +[INFO] No sources to compile +[INFO] +[INFO] --- surefire:3.5.3:test (default-test) @ primary-source --- +[INFO] No tests to run. +[INFO] +[INFO] --- jar:3.4.2:jar (default-jar) @ primary-source --- +[WARNING] JAR will be empty - no content was marked for inclusion! +[INFO] Building jar: /home/herve/dev/maven/sources/studies/deploy/projects/primary-source/target/primary-source-1.0.jar +[INFO] +[INFO] --- install:3.1.4:install (default-install) @ primary-source --- +[INFO] Installing /home/herve/dev/maven/sources/studies/deploy/projects/primary-source/pom.xml to /home/herve/.m2/repository/org/apache/maven/studies/primary-source/1.0/primary-source-1.0.pom +[INFO] Installing /home/herve/dev/maven/sources/studies/deploy/projects/primary-source/target/primary-source-1.0.jar to /home/herve/.m2/repository/org/apache/maven/studies/primary-source/1.0/primary-source-1.0.jar +[INFO] +[INFO] --- nxrm3:1.0.12:deploy (default-deploy) @ primary-source --- +[INFO] Tag deploy-1.0-1759652819873 already exists, skipping creation +[INFO] Saving staging information to /home/herve/dev/maven/sources/studies/deploy/target/nexus-staging/staging/staging.properties +[INFO] Deploying to repository 'maven-staging' with tag 'deploy-1.0-1759652819873' +[INFO] +[INFO] -------------------< org.apache.maven.studies:ejbs >-------------------- +[INFO] Building enterprise java beans 1.0 [5/7] +[INFO] from projects/ejbs/pom.xml +[INFO] --------------------------------[ ejb ]--------------------------------- +[INFO] +[INFO] --- clean:3.5.0:clean (default-clean) @ ejbs --- +[INFO] Deleting /home/herve/dev/maven/sources/studies/deploy/projects/ejbs/target +[INFO] +[INFO] --- resources:3.3.1:resources (default-resources) @ ejbs --- +[INFO] Copying 1 resource from src/main/resources to target/classes +[INFO] +[INFO] --- compiler:3.14.0:compile (default-compile) @ ejbs --- +[INFO] No sources to compile +[INFO] +[INFO] --- resources:3.3.1:testResources (default-testResources) @ ejbs --- +[INFO] skip non existing resourceDirectory /home/herve/dev/maven/sources/studies/deploy/projects/ejbs/src/test/resources +[INFO] +[INFO] --- compiler:3.14.0:testCompile (default-testCompile) @ ejbs --- +[INFO] No sources to compile +[INFO] +[INFO] --- surefire:3.5.3:test (default-test) @ ejbs --- +[INFO] No tests to run. +[INFO] +[INFO] --- ejb:3.2.1:ejb (default-ejb) @ ejbs --- +[INFO] Building EJB ejbs-1.0 with EJB version 3.1 +[INFO] Building jar: /home/herve/dev/maven/sources/studies/deploy/projects/ejbs/target/ejbs-1.0.jar +[INFO] +[INFO] --- install:3.1.4:install (default-install) @ ejbs --- +[INFO] Installing /home/herve/dev/maven/sources/studies/deploy/projects/ejbs/pom.xml to /home/herve/.m2/repository/org/apache/maven/studies/ejbs/1.0/ejbs-1.0.pom +[INFO] Installing /home/herve/dev/maven/sources/studies/deploy/projects/ejbs/target/ejbs-1.0.jar to /home/herve/.m2/repository/org/apache/maven/studies/ejbs/1.0/ejbs-1.0.jar +[INFO] +[INFO] --- nxrm3:1.0.12:deploy (default-deploy) @ ejbs --- +[INFO] Tag deploy-1.0-1759652819873 already exists, skipping creation +[INFO] Saving staging information to /home/herve/dev/maven/sources/studies/deploy/target/nexus-staging/staging/staging.properties +[INFO] Deploying to repository 'maven-staging' with tag 'deploy-1.0-1759652819873' +[INFO] +[INFO] ------------------< org.apache.maven.studies:servlet >------------------ +[INFO] Building servlet 1.0 [6/7] +[INFO] from projects/servlet/pom.xml +[INFO] --------------------------------[ war ]--------------------------------- +[INFO] +[INFO] --- clean:3.5.0:clean (default-clean) @ servlet --- +[INFO] Deleting /home/herve/dev/maven/sources/studies/deploy/projects/servlet/target +[INFO] +[INFO] --- resources:3.3.1:resources (default-resources) @ servlet --- +[INFO] skip non existing resourceDirectory /home/herve/dev/maven/sources/studies/deploy/projects/servlet/src/main/resources +[INFO] +[INFO] --- compiler:3.14.0:compile (default-compile) @ servlet --- +[INFO] No sources to compile +[INFO] +[INFO] --- resources:3.3.1:testResources (default-testResources) @ servlet --- +[INFO] skip non existing resourceDirectory /home/herve/dev/maven/sources/studies/deploy/projects/servlet/src/test/resources +[INFO] +[INFO] --- compiler:3.14.0:testCompile (default-testCompile) @ servlet --- +[INFO] No sources to compile +[INFO] +[INFO] --- surefire:3.5.3:test (default-test) @ servlet --- +[INFO] No tests to run. +[INFO] +[INFO] --- war:3.4.0:war (default-war) @ servlet --- +[INFO] Packaging webapp +[INFO] Assembling webapp [servlet] in [/home/herve/dev/maven/sources/studies/deploy/projects/servlet/target/servlet-1.0] +[INFO] Processing war project +[INFO] Copying webapp resources [/home/herve/dev/maven/sources/studies/deploy/projects/servlet/src/main/webapp] +[INFO] Building war: /home/herve/dev/maven/sources/studies/deploy/projects/servlet/target/servlet-1.0.war +[INFO] +[INFO] --- install:3.1.4:install (default-install) @ servlet --- +[INFO] Installing /home/herve/dev/maven/sources/studies/deploy/projects/servlet/pom.xml to /home/herve/.m2/repository/org/apache/maven/studies/servlet/1.0/servlet-1.0.pom +[INFO] Installing /home/herve/dev/maven/sources/studies/deploy/projects/servlet/target/servlet-1.0.war to /home/herve/.m2/repository/org/apache/maven/studies/servlet/1.0/servlet-1.0.war +[INFO] +[INFO] --- nxrm3:1.0.12:deploy (default-deploy) @ servlet --- +[INFO] Tag deploy-1.0-1759652819873 already exists, skipping creation +[INFO] Saving staging information to /home/herve/dev/maven/sources/studies/deploy/target/nexus-staging/staging/staging.properties +[INFO] Deploying to repository 'maven-staging' with tag 'deploy-1.0-1759652819873' +[INFO] +[INFO] --------------------< org.apache.maven.studies:ear >-------------------- +[INFO] Building ear assembly 1.0 [7/7] +[INFO] from projects/ear/pom.xml +[INFO] --------------------------------[ ear ]--------------------------------- +[INFO] +[INFO] --- clean:3.5.0:clean (default-clean) @ ear --- +[INFO] Deleting /home/herve/dev/maven/sources/studies/deploy/projects/ear/target +[INFO] +[INFO] --- ear:3.4.0:generate-application-xml (default-generate-application-xml) @ ear --- +[INFO] Generating application.xml +[INFO] +[INFO] --- resources:3.3.1:resources (default-resources) @ ear --- +[INFO] skip non existing resourceDirectory /home/herve/dev/maven/sources/studies/deploy/projects/ear/src/main/resources +[INFO] +[INFO] --- ear:3.4.0:ear (default-ear) @ ear --- +[INFO] Copying artifact [ejb:org.apache.maven.studies:ejbs:1.0] to [org.apache.maven.studies-ejbs-1.0.jar] +[INFO] Copying artifact [war:org.apache.maven.studies:servlet:1.0] to [org.apache.maven.studies-servlet-1.0.war] +[INFO] Copying artifact [jar:org.apache.maven.studies:primary-source:1.0] to [org.apache.maven.studies-primary-source-1.0.jar] +[INFO] Copying artifact [jar:org.apache.maven.studies:logging:1.0] to [org.apache.maven.studies-logging-1.0.jar] +[INFO] Building ear: /home/herve/dev/maven/sources/studies/deploy/projects/ear/target/ear-1.0.ear +[INFO] +[INFO] --- install:3.1.4:install (default-install) @ ear --- +[INFO] Installing /home/herve/dev/maven/sources/studies/deploy/projects/ear/pom.xml to /home/herve/.m2/repository/org/apache/maven/studies/ear/1.0/ear-1.0.pom +[INFO] Installing /home/herve/dev/maven/sources/studies/deploy/projects/ear/target/ear-1.0.ear to /home/herve/.m2/repository/org/apache/maven/studies/ear/1.0/ear-1.0.ear +[INFO] +[INFO] --- nxrm3:1.0.12:deploy (default-deploy) @ ear --- +[INFO] Tag deploy-1.0-1759652819873 already exists, skipping creation +[INFO] Saving staging information to /home/herve/dev/maven/sources/studies/deploy/target/nexus-staging/staging/staging.properties +[INFO] Deploying to repository 'maven-staging' with tag 'deploy-1.0-1759652819873' +[INFO] ------------------------------------------------------------------------ +[INFO] Reactor Summary for deploy study root 1.0: +[INFO] +[INFO] deploy study root .................................. SUCCESS [ 0.664 s] +[INFO] sub projects ....................................... SUCCESS [ 0.263 s] +[INFO] logging ............................................ SUCCESS [ 0.520 s] +[INFO] core project classes ............................... SUCCESS [ 0.296 s] +[INFO] enterprise java beans .............................. SUCCESS [ 0.378 s] +[INFO] servlet ............................................ SUCCESS [ 0.374 s] +[INFO] ear assembly ....................................... SUCCESS [ 0.413 s] +[INFO] ------------------------------------------------------------------------ +[INFO] BUILD SUCCESS +[INFO] ------------------------------------------------------------------------ +[INFO] Total time: 3.301 s +[INFO] Finished at: 2025-10-05T10:27:02+02:00 +[INFO] ------------------------------------------------------------------------ +[INFO] Njord session closed +``` +</details> + +\ +Notice: +- plugin has a publicly visible Git repository: https://github.com/sonatype/nxrm3-maven-plugin +- ignores `distributionManagement` +- requires Java 17 +- requires configuration in pom.xml to disable `maven-deploy-plugin` (or use [`nxrm3:prepare-deploy`](https://github.com/sonatype/nxrm3-maven-plugin?tab=readme-ov-file#allowing-deployment-of--snapshots) that seems to take care of SNAPSHOT vs release?) +- TBD: for multi-module, test [deferred deployment](https://github.com/sonatype/nxrm3-maven-plugin?tab=readme-ov-file#deferred-deployment) diff --git a/README.md b/README.md index 23ee6b1f3..49d600c93 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ This study starts with a [base base project](1_DISCOVERY.md) for the problem spa 4. [use of Sonatype Central Publishing Maven Plugin](1.4_DISCOVERY-central-publishing.md) 5. [use of njord Maven Resolver extension](1.5_DISCOVERY-njord.md) 6. [use of JReleaser](1.6_DISCOVERY-jreleaser.md) - +7. [use of NXRM3](1.7_DISCOVERY-nxrm3-staging.md) This will be followed by an evaluation based on differences: - use of classical `pom.xml` configuration of publication target for SNASPHOT and release: `<project><distributionManagement><release><id>/<url>`, @@ -34,7 +34,7 @@ Pro: Easy to configure. Drawbacks: - no configuration in `pom.xml` `distributionManagement` - [plugin](https://central.sonatype.com/artifact/org.sonatype.central/central-publishing-maven-plugin) has OSS license and code visible in `-source.jar` but not in Git, and the governance and roadmap of is not open, -- plugin deletes `maven-deploy-plugin` at runtime, which confuses plugins like `maven-artifact-plugin`, `cyclonedx-maven-plugin` or `spdx-maven-plugin` which detect skipped modules for deployment +- plugin deletes `maven-deploy-plugin` at runtime, which confuses plugins like `maven-artifact-plugin`, `cyclonedx-maven-plugin` or `spdx-maven-plugin` that detect skipped modules for deployment - does not work for Maven 4 (runtime deletion of a plugin binding will probably be a blocker) ## Option 3: njord diff --git a/pom.xml b/pom.xml index 8713141ec..1c174705d 100644 --- a/pom.xml +++ b/pom.xml @@ -115,6 +115,55 @@ </pluginManagement> </build> </profile> + + <profile> + <id>asf-nxrm3</id> + <!--distributionManagement> + <repository> + <id>rao3</id> + <name>NXRM Releases</name> + <url>https://repository.apache.org:4443/repository/maven-staging/</url> + </repository> + <snapshotRepository> + <id>rao3</id> + <name>NXRM Snapshots</name> + <url>https://repository.apache.org:4443/repository/maven-snapshots/</url> + </snapshotRepository> + </distributionManagement--> + <build> + <plugins> + <plugin> + <groupId>org.sonatype.plugins</groupId> + <artifactId>nxrm3-maven-plugin</artifactId> + <version>1.0.12</version> + <extensions>true</extensions> + <configuration> + <nexusUrl>https://repository.apache.org:4443/</nexusUrl> + <serverId>rao3</serverId> + <repository>maven-staging</repository> + </configuration> + <executions> + <execution> + <id>default-deploy</id> + <phase>deploy</phase> + <goals> + <goal>deploy</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-deploy-plugin</artifactId> + <executions> + <execution> + <id>default-deploy</id> + <phase>deploy-skip</phase><!-- disable standard maven-deploy-plugin deploy --> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> </profiles> <dependencyManagement>
