Skip to content

Commit 7fa157b

Browse files
committed
Update config for publishing to Maven Central:
- Add fake Javadoc files with readme.txt referring to docs.zip file - New staging URL (it also requires to send a "close" command at end, not yet implemented) - Snapshots not working yet, it fails to upload maven-metadata.xml because server sends error 400
1 parent 258ef18 commit 7fa157b

File tree

2 files changed

+27
-13
lines changed

2 files changed

+27
-13
lines changed

build.xml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,7 @@
149149
<property name="jar-file" location="dist/${artifactId}-${version}.jar" />
150150
<property name="sources-jar-file" location="dist/${artifactId}-${version}-sources.jar" />
151151
<property name="documentation-file" location="dist/${artifactId}-${version}-docs.zip" />
152-
153-
<!-- defined maven snapshots and staging repository id and url -->
154-
<property name="maven-snapshots-repository-id" value="sonatype-nexus-snapshots" />
155-
<property name="maven-snapshots-repository-url" value="https://oss.sonatype.org/content/repositories/snapshots/" />
156-
<property name="maven-staging-repository-id" value="sonatype-nexus-staging" />
157-
<property name="maven-staging-repository-url" value="https://oss.sonatype.org/service/local/staging/deploy/maven2/" />
152+
<property name="fake-javadoc-file" location="dist/${artifactId}-${version}-javadoc.jar" />
158153

159154
<!-- GPG settings -->
160155
<property name="gpg.exe" value="gpg" />
@@ -446,6 +441,12 @@
446441
<zip destfile="${documentation-file}" encoding="${build.encoding}">
447442
<zipfileset dir="${documentation-dir}" prefix="${artifactId}-${version}"/>
448443
</zip>
444+
<zip destfile="${fake-javadoc-file}" encoding="${build.encoding}">
445+
<mappedresources>
446+
<string>The forbiddenapis plugin provides no Javadocs. The full user documentation for Ant/Maven/Gradle usage is provided by the artifact with classifier 'docs' and type 'zip'.&#10;</string>
447+
<mergemapper to="README.txt"/>
448+
</mappedresources>
449+
</zip>
449450
</target>
450451

451452
<target name="jar" depends="compile,-install-tasks,maven-descriptor" description="Create the binary JAR">
@@ -498,11 +499,15 @@
498499
<target name="stage" depends="-stage.snapshots,-stage.release" description="Create the distribution"/>
499500

500501
<target name="-stage.snapshots" depends="dist" if="isSnapshot">
502+
<!--
501503
<artifact:deploy file="${jar-file}">
502504
<pom refid="maven.deploy.pom"/>
503-
<attach file="${sources-jar-file}" classifier="sources"/>
505+
<attach file="${sources-jar-file}" classifier="sources" type="jar"/>
506+
<attach file="${fake-javadoc-file}" classifier="javadoc" type="jar"/>
504507
<attach file="${documentation-file}" classifier="docs" type="zip"/>
505508
</artifact:deploy>
509+
-->
510+
<echo level="warn" message="Deploying Maven Snapshots to Sonatype is currently not supported. Working on a fix with support..."/>
506511
</target>
507512

508513
<target name="sign-artifacts" depends="dist" unless="isSnapshot">
@@ -537,12 +542,14 @@
537542
<target name="-stage.release" depends="sign-artifacts" unless="isSnapshot">
538543
<artifact:deploy file="${jar-file}">
539544
<pom refid="maven.deploy.pom"/>
540-
<attach file="${sources-jar-file}" classifier="sources"/>
545+
<attach file="${sources-jar-file}" classifier="sources" type="jar"/>
546+
<attach file="${fake-javadoc-file}" classifier="javadoc" type="jar"/>
541547
<attach file="${documentation-file}" classifier="docs" type="zip"/>
542548
<!-- signatures: -->
543549
<attach file="${pom-file}.asc" type="pom.asc"/>
544550
<attach file="${jar-file}.asc" type="jar.asc"/>
545551
<attach file="${sources-jar-file}.asc" classifier="sources" type="jar.asc"/>
552+
<attach file="${fake-javadoc-file}.asc" classifier="javadoc" type="jar.asc"/>
546553
<attach file="${documentation-file}.asc" classifier="docs" type="zip.asc"/>
547554
</artifact:deploy>
548555
</target>

src/main/maven/pom-deploy.xml.template

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,18 @@
2626
<inceptionYear>2013</inceptionYear>
2727
<packaging>maven-plugin</packaging>
2828

29-
<parent>
30-
<groupId>org.sonatype.oss</groupId>
31-
<artifactId>oss-parent</artifactId>
32-
<version>9</version>
33-
</parent>
29+
<distributionManagement>
30+
<snapshotRepository>
31+
<id>sonatype-nexus-snapshots</id>
32+
<name>Sonatype Nexus Snapshots</name>
33+
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
34+
</snapshotRepository>
35+
<repository>
36+
<id>sonatype-nexus-staging</id>
37+
<name>Nexus Release Repository</name>
38+
<url>https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/</url>
39+
</repository>
40+
</distributionManagement>
3441

3542
<licenses>
3643
<license>

0 commit comments

Comments
 (0)