Skip to content

Commit 77fe152

Browse files
Support/Prepare deployment to new maven central repository
1 parent 6451cf5 commit 77fe152

File tree

3 files changed

+30
-27
lines changed

3 files changed

+30
-27
lines changed

build.xml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,8 @@
7575
<property name="platform-jpms-jar" value="${dist}/jna-platform-jpms.jar" />
7676

7777
<!-- defined maven snapshots and staging repository id and url -->
78-
<property name="maven-snapshots-repository-id" value="oss.sonatype.org" />
79-
<property name="maven-snapshots-repository-url" value="https://oss.sonatype.org/content/repositories/snapshots/" />
80-
<property name="maven-staging-repository-id" value="oss.sonatype.org" />
81-
<property name="maven-staging-repository-url" value="https://oss.sonatype.org/service/local/staging/deploy/maven2/" />
78+
<property name="maven-snapshots-repository-id" value="sonatype-central-portal-snapshots" />
79+
<property name="maven-snapshots-repository-url" value="https://central.sonatype.com/repository/maven-snapshots/" />
8280

8381
<!-- Miscellaneous -->
8482
<property name="build" value="build"/>
@@ -1516,11 +1514,14 @@ cd ..
15161514
<property name="version-maven-gpg-plugin" value="1.4"/>
15171515

15181516
<target name="stage" depends="dist" description="deploy release version to Maven staging repository">
1517+
<delete dir="build/maven-artifacts" />
1518+
<delete file="build/maven-artifacts.zip" />
1519+
<mkdir dir="build/maven-artifacts" />
1520+
<makeurl property="maven-artifacts" file="build/maven-artifacts" />
15191521
<!-- sign and deploy the jna, artifact -->
15201522
<exec executable="mvn" searchpath="true" failonerror="true" failifexecutionfails="true" logError="true">
15211523
<arg value="org.apache.maven.plugins:maven-gpg-plugin:${version-maven-gpg-plugin}:sign-and-deploy-file"/>
1522-
<arg value="-Durl=${maven-staging-repository-url}"/>
1523-
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
1524+
<arg value="-Durl=${maven-artifacts}"/>
15241525
<arg value="-DpomFile=${pom}"/>
15251526
<arg value="-Dfile=${dist-jar}"/>
15261527
<arg value="-Dfiles=${maven-sources-jar},${maven-javadoc-jar},${dist-aar}"/>
@@ -1532,8 +1533,7 @@ cd ..
15321533
<!-- sign and deploy the platform artifact -->
15331534
<exec executable="mvn" searchpath="true" failonerror="true" failifexecutionfails="true" logError="true">
15341535
<arg value="org.apache.maven.plugins:maven-gpg-plugin:${version-maven-gpg-plugin}:sign-and-deploy-file"/>
1535-
<arg value="-Durl=${maven-staging-repository-url}"/>
1536-
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
1536+
<arg value="-Durl=${maven-artifacts}"/>
15371537
<arg value="-DpomFile=${pom-platform}"/>
15381538
<arg value="-Dfile=${platform-jar}"/>
15391539
<arg value="-Dfiles=${platform-sources-jar},${platform-javadoc-jar}"/>
@@ -1545,8 +1545,7 @@ cd ..
15451545
<!-- sign and deploy the jna, artifact -->
15461546
<exec executable="mvn" searchpath="true" failonerror="true" failifexecutionfails="true" logError="true">
15471547
<arg value="org.apache.maven.plugins:maven-gpg-plugin:${version-maven-gpg-plugin}:sign-and-deploy-file"/>
1548-
<arg value="-Durl=${maven-staging-repository-url}"/>
1549-
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
1548+
<arg value="-Durl=${maven-artifacts}"/>
15501549
<arg value="-DpomFile=${pom-jpms}"/>
15511550
<arg value="-Dfile=${dist-jar-jpms}"/>
15521551
<arg value="-Dfiles=${maven-sources-jar},${maven-javadoc-jar}"/>
@@ -1558,15 +1557,17 @@ cd ..
15581557
<!-- sign and deploy the platform artifact -->
15591558
<exec executable="mvn" searchpath="true" failonerror="true" failifexecutionfails="true" logError="true">
15601559
<arg value="org.apache.maven.plugins:maven-gpg-plugin:${version-maven-gpg-plugin}:sign-and-deploy-file"/>
1561-
<arg value="-Durl=${maven-staging-repository-url}"/>
1562-
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
1560+
<arg value="-Durl=${maven-artifacts}"/>
15631561
<arg value="-DpomFile=${pom-platform-jpms}"/>
15641562
<arg value="-Dfile=${platform-jpms-jar}"/>
15651563
<arg value="-Dfiles=${platform-sources-jar},${platform-javadoc-jar}"/>
15661564
<arg value="-Dtypes=jar,jar"/>
15671565
<arg value="-Dclassifiers=sources,javadoc"/>
15681566
<arg value="-Dgpg.useagent=true"/>
15691567
</exec>
1568+
1569+
<zip destfile="build/maven-artifacts.zip"
1570+
basedir="build/maven-artifacts"/>
15701571
</target>
15711572

15721573
<target name="checkstyle">

www/PublishingToMavenCentral.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,33 @@ Publishing JNA to Maven Central
44
One Time
55
--------
66

7-
* Create an account in the [sonatype jira](https://issues.sonatype.org/secure/Signup!default.jspa)
7+
* Create an account for the maven central repository
8+
([Register to Publish Via the Central Portal](https://central.sonatype.org/register/central-portal/))
89
* Get the account enabled for publishing to the net.java.dev.jna groupId
910
(contact an existing uploader for this)
1011
* Set up your gpg keys as described [here](http://central.sonatype.org/pages/working-with-pgp-signatures.html). Make sure you distribute your public key.
1112
* Make sure you have a settings.xml file (in directory: ${user.home}/.m2/).
12-
For example (Replace *myossrhuser* and *myossrhpwd* with the account credentials):
13+
For example (Replace *central-user* and *central-password* with the
14+
credentials you can create via "View Account" -> "Generate User Token"):
1315
```xml
1416
<settings>
1517
...
1618
<servers>
1719
...
1820
<server>
19-
<id>oss.sonatype.org</id>
20-
<username>myossrhuser</username>
21-
<password>myossrhpwd</password>
21+
<id>sonatype-central-portal-snapshots</id>
22+
<username>central-user</username>
23+
<password>central-password</password>
2224
</server>
2325
...
2426
</servers>
2527
...
2628
<settings>
2729
```
28-
29-
The binaries are hosted in the Sonatype OSSRH (OSS Repository Hosting) system,
30-
and mirrored from there to maven central.
3130

32-
See [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more info.
31+
These settings are only used for uploading SNAPSHOTs. See:
32+
[Publishing -SNAPSHOT Releases](https://central.sonatype.org/publish/publish-portal-snapshots/)
33+
for more info.
3334

3435
Publish Snapshot
3536
----------------
@@ -39,9 +40,7 @@ Publish Snapshot
3940
Before doing a full jna release, we can publish a development SNAPSHOT of the "next" release for people to test. The
4041
SNAPSHOT will be published in the staging repository:
4142

42-
[https://oss.sonatype.org/content/repositories/snapshots/](https://oss.sonatype.org/content/repositories/snapshots/)
43-
44-
see: [https://oss.sonatype.org/content/repositories/snapshots/net/java/dev/jna/](https://oss.sonatype.org/content/repositories/snapshots/net/java/dev/jna/) for the various jars.
43+
[https://central.sonatype.com/repository/maven-snapshots/](https://central.sonatype.com/repository/maven-snapshots/)
4544

4645
To publish a development SNAPSHOT do the following:
4746

@@ -58,5 +57,7 @@ Publish Release
5857
* Verify the &lt;version> tags in [pom-jna.xml](https://github.com/java-native-access/jna/blob/master/pom-jna.xml)
5958
and [pom-jna-platform.xml](https://github.com/java-native-access/jna/blob/master/pom-jna-platform.xml)
6059
match the version (jna.version) in [build.xml](https://github.com/java-native-access/jna/blob/master/build.xml).
61-
* Run `ant -Dmaven-release=true stage`. This uploads current checkout to [oss.sonatype.org](https://oss.sonatype.org).
62-
* Follow steps from [Releasing the Deployment](http://central.sonatype.org/pages/releasing-the-deployment.html).
60+
* Run `ant -Dmaven-release=true stage`. This builds JNA and creates a ZIP file `build/maven-artifacts.zip`.
61+
That file can be used to deploy to maven central using the manual
62+
[Publishing By Uploading a Bundle](https://central.sonatype.org/publish/publish-portal-upload/)
63+
process.

www/ReleasingJNA.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ JNA Release Process
1818

1919
* Commit and push generated files in `dist`, `CHANGES.md` and `README.md`.
2020

21-
* Login to https://oss.sonatype.org and release the maven artifacts
21+
* Login to https://central.sonatype.com/ and create a new deployment using the
22+
file `build/maven-artifacts.zip`.
2223

2324
* Tag
2425
* Tag using the new version number (e.g. `git tag 4.2.1`)

0 commit comments

Comments
 (0)