Skip to content

Commit

Permalink
Adjust pom.xml to facilitate deployment
Browse files Browse the repository at this point in the history
Follow advice at https://central.sonatype.org/publish/publish-maven/
to deploy the package to the central repository.

Various changes needed including changing the groupId since I have
publish permissions for uk.ac.starlink but not for org.astrogrid.

mvn deploy now seems to work to deploy the package to central.sonatype.com.

It is also possible to do the deployment manually.
I've added a hints.txt file to explain how that is currently done.

Make a few cosmetic changes too.
  • Loading branch information
mbtaylor committed Mar 13, 2024
1 parent 221ff67 commit 81e4c9c
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 7 deletions.
58 changes: 58 additions & 0 deletions hints.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
Notes:
------
mvn clean
mvn package
mvn site
mvn -DskipTests

On release:
-----------

(I'm pretty sure I'm comprehensively missing the point of maven by
having to do this manually).

update version number in pom.xml in TWO places:
<project>/<version>
<project>/<properties>/<jsampVersion>

mvn clean package site install

# 2024 I no longer have a code-signing certificate, so can't do this.
jarsigner
-keystore /home/mbt/certs/comodo-uob.p12
-storetype pkcs12
-tsa http://timestamp.comodoca.com
-signedjar target/jsamp-${pom.currentVersion}_signed.jar
target/jsamp-${pom.currentVersion}.jar
uob

cp target/jsamp-x.x.x.jar /home/mbt/public_html/releases/jsamp/

rm -rf /home/mbt/public_html/jsamp
mkdir /home/mbt/public_html/jsamp
cp target/jsamp-x.x.x.jar /home/mbt/public_html/jsamp/
cp -r target/site/* /home/mbt/public_html/jsamp

tag and add jar file to github release

# mvn deploy seems to work to deploy the thing to the central repo
# at https://central.sonatype.com/search?q=g:uk.ac.starlink
# I followed instructions at
# https://central.sonatype.org/publish/publish-maven/
# This can also be done manually in the same way as for
# /mbt/devel/stil/makefile, as below.

mvn gpg:sign-and-deploy-file -Durl=https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ -DrepositoryId=ossrh -DpomFile=pom.xml -Dfile=target/jsamp-x.x.x.jar
mvn gpg:sign-and-deploy-file -Durl=https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ -DrepositoryId=ossrh -DpomFile=pom.xml -Dfile=target/jsamp-x.x.x-sources.jar -Dclassifier=sources
mvn gpg:sign-and-deploy-file -Durl=https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ -DrepositoryId=ossrh -DpomFile=pom.xml -Dfile=target/jsamp-x.x.x-javadoc.jar -Dclassifier=javadoc

# This uses ~/.m2/settings.xml, which looks like:
<settings>
<servers>
<server>
<id>ossrh</id>
<username>mbtaylor</username>
<password>xxx</password>
</server>
</servers>
</settings>
74 changes: 67 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.astrogrid</groupId>
<groupId>uk.ac.starlink</groupId>
<artifactId>jsamp</artifactId>
<version>1.3.8</version>
<name>JSAMP</name>
<url>http://www.star.bristol.ac.uk/~mbt/jsamp/</url>
<url>http://www.star.bristol.ac.uk/mbt/jsamp/</url>
<licenses>
<license>
<name>The Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<scm>
<connection>scm:git:https://github.com/mbtaylor/jsamp.git</connection>
<developerConnection>scm:git:git@github.com:mbtaylor/jsamp.git</developerConnection>
<url>https://github.com/mbtaylor/jsamp/tree/master</url>
</scm>
<description>Various components used for developing and deploying
Simple Applications Messaging Protocol-compliant
Expand All @@ -23,8 +30,8 @@
<id>mbt</id>
<name>Mark Taylor</name>
<email>m.b.taylor@bristol.ac.uk</email>
<url>http://www.star.bristol.ac.uk/~mbt/</url>
<organization>Bristol University</organization>
<url>http://www.star.bristol.ac.uk/mbt/</url>
<organization>University of Bristol</organization>
</developer>
</developers>

Expand Down Expand Up @@ -52,7 +59,7 @@
! (or anything else).
! Currently I'm doing that copying by hand when releasing
! a new version. -->
<url>file:///homeb/mbt/public_html/jsamp/</url>
<url>file:///home/mbt/public_html/jsamp/</url>
</site>
</distributionManagement>

Expand Down Expand Up @@ -168,8 +175,61 @@
</plugin>

<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.1</version>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>false</autoReleaseAfterClose>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
Expand Down

0 comments on commit 81e4c9c

Please sign in to comment.