Skip to content

Add infrastructure to publish library to Maven Central#7

Open
sbesson wants to merge 6 commits into
glencoesoftware:masterfrom
sbesson:central_publication
Open

Add infrastructure to publish library to Maven Central#7
sbesson wants to merge 6 commits into
glencoesoftware:masterfrom
sbesson:central_publication

Conversation

@sbesson

@sbesson sbesson commented Jun 19, 2026

Copy link
Copy Markdown
Member

This adds the infrastructure to publish this library to Maven Central and fixes #2

Build changes:

  • the component group is changed to com.glencoesoftware to match the namespace in Maven Central
  • a top-level BSD-3 clause license is added to the repository consistently with the underlying library
  • a jreleaser configuration is added to build.gradle as described in https://jreleaser.org/guide/latest/examples/maven/maven-central.html with the minimal metadata requirements for publishing to Central, both as releases and as SNAPSHOTS
  • the jar-pack.sh utility is refactored to copy the pre-compiled libraries under src/main/resources allowing ./gradlew jar to automatically bundle them in the packaged library

GitHub actions changes:

  • the Windows GitHub runner label is updated to windows-2022 as the latest image is using Visual Studio 2026 and is incompatible with the CMake requirements of the 1.x library - see [Windows] windows-latest and windows-2025 image-label will use Windows Server 2025 with Visual Studio 2026 image in June 2026 actions/runner-images#14017. This can probably be reviewed once this component is upgraded to build libjpeg-turbo 3.x
  • the different phases are updated to use the new jar-pack.sh logic before running the ./gradlew build target
  • the test phase is moved before the packaging phase which also includes a deployment to Maven Central on push
  • the minimal set of environment variables allowing to sign and deploy SNAPSHOT and release artifacts to Maven Central are added to the environment of the deploy phase

sbesson added 6 commits June 19, 2026 01:14
The windows-latest label is migrated to Visual Studio 2026 by default
- Update jar-pack.sh to move the pre-compiled binaries under src/main/resources
- Remove logic repacking or replacing the JARs
- Execute the tests  immediately after compiling the libraries
- Add a final deploy step including publication and GitHub release
See https://jreleaser.org/guide/latest/examples/maven/maven-central.html
and https://central.sonatype.org/publish/requirements/
- Build javadoc and sources
- Add publication step with a populated POM (scm, developers, license...)
- Add jreleaser section allowing to publish releases and snapshots
- run ./gradlew publish jreleaserDeploy on push events only
- expose the environment variables allowing to sign and deploy SNAPSHOTs and releases
@sbesson

sbesson commented Jun 19, 2026

Copy link
Copy Markdown
Member Author

Note that as per ed458f4, the publication to Maven Central is not tested in a PR workflow.

As a proof-of-concept, I set up secrets on my fork to populate the environment variables defined in the deploy step using a token on Maven Central and my GPG key. The result has been deployed to Maven Central as a SNAPSHOT with the following stack trace - see https://github.com/sbesson/libjpeg-turbo-java/actions/runs/27813184919

> Task :jreleaserDeploy
[INFO]  JReleaser 1.24.0
[INFO]    - basedir set to /home/runner/work/libjpeg-turbo-java/libjpeg-turbo-java
[INFO]    - outputdir set to /home/runner/work/libjpeg-turbo-java/libjpeg-turbo-java/build/jreleaser
[INFO]  git-root-search set to false
🚨 pgp.publicKey is deprecated since 1.24.0 and will be removed in 2.0.0.
[INFO]  Loading variables from /home/runner/.jreleaser/config.properties
[WARN]  Variables source /home/runner/.jreleaser/config.properties does not exist
[INFO]  Validating configuration
[INFO]  Strict mode set to false
[INFO]  Reproducible set to false
[WARN]    [validation] Deployer mavenCentral:release-deploy is not enabled. Skipping
[INFO]  Project version set to 0.1.0-SNAPSHOT
[INFO]  Release is snapshot
[INFO]  Timestamp is 2026-06-19T08:02:12.20669883Z
[INFO]  HEAD is at ed458f4
[INFO]  Platform is linux-x86_64
[INFO]  yolo set to false
[INFO]  dry-run set to false
[INFO]  Deploying Maven artifacts
[INFO]    [maven] Deploying all staged artifacts
[INFO]      [nexus2] Deploying to snapshot-deploy
[INFO]      [nexus2] nexus2 set to FULL_DEPLOYMENT
[INFO]      [nexus2] Verifying prerequisites
[INFO]      [nexus2] Verifying POMs
[WARN]      [nexus2] Signing key 43FA723866BFA9D2 does not expire
[INFO]      [nexus2] Checking if key 43FA723866BFA9D2 has been published
[INFO]      [nexus2] Key 43FA723866BFA9D2 was found as published
[INFO]      [sign] build/staging-deploy/com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1.module
[INFO]      [sign] build/staging-deploy/com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1.jar
[INFO]      [sign] build/staging-deploy/com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1-sources.jar
[INFO]      [sign] build/staging-deploy/com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1-javadoc.jar
[INFO]      [sign] build/staging-deploy/com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1.pom
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1.jar.sha1
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1-sources.jar.md5
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1.pom.md5
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/maven-metadata.xml.md5
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1-javadoc.jar.md5
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/maven-metadata.xml.sha512
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1.module.sha256
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/maven-metadata.xml.md5
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1.pom.sha256
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1.pom.sha512
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1.module.sha512
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/maven-metadata.xml.sha1
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1.module
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1-javadoc.jar.sha512
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1.jar.sha512
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/maven-metadata.xml
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1.pom.asc
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1.jar.md5
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1-javadoc.jar.sha1
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1.jar.sha256
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1-javadoc.jar.sha256
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1.pom.sha1
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1.module.sha1
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/maven-metadata.xml
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/maven-metadata.xml.sha256
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/maven-metadata.xml.sha1
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1.jar.asc
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1-sources.jar.sha1
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1.jar
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1.pom
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/maven-metadata.xml.sha256
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1.module.asc
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1-sources.jar.asc
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1-sources.jar
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/maven-metadata.xml.sha512
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1-javadoc.jar
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1-sources.jar.sha512
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1-javadoc.jar.asc
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1-sources.jar.sha256
[INFO]      [nexus2]  - com/glencoesoftware/libjpeg-turbo/0.1.0-SNAPSHOT/libjpeg-turbo-0.1.0-20260619.080209-1.module.md5
[INFO]  Writing output properties to build/jreleaser/output.properties
[INFO]  JReleaser succeeded after 36.290 s

BUILD SUCCESSFUL in 43s
10 actionable tasks: 8 executed, 2 up-to-date

The published SNAPSHOT has been consumed in a loca build of bioformats2raw with the following modifications

diff --git a/build.gradle b/build.gradle
index 465ab37..580ac54 100644
--- a/build.gradle
+++ b/build.gradle
@@ -33,11 +33,21 @@ repositories {
         name 'Unidata'
         url 'https://artifacts.glencoesoftware.com/artifactory/unidata-releases'
     }
+    maven {
+        name = 'Central Portal Snapshots'
+        url = 'https://central.sonatype.com/repository/maven-snapshots/'
+
+        // Only search this repository for the specific dependency
+        content {
+            includeModule("com.glencoesoftware", "libjpeg-turbo")
+        }
+    }
 }
 
 configurations.all {
     resolutionStrategy.cacheChangingModulesFor 0, 'minutes'
-    exclude group: 'edu.ucar', 'module': 'cdm'
+    exclude group: 'edu.ucar', module: 'cdm'
+    exclude group: "ome", module: "turbojpeg"
 }
 
 dependencies {
@@ -51,6 +61,7 @@ dependencies {
 
     implementation 'org.openpnp:opencv:4.7.0-0'
     implementation 'me.tongfei:progressbar:0.10.2'
+    implementation 'com.glencoesoftware:libjpeg-turbo:0.1.0-SNAPSHOT'
 
     // https://github.com/junit-team/junit5-samples/blob/master/junit5-migration-gradle/build.gradle
     def junitVintageVersion  = '5.7.0'

and tested in my local environment (macOs 26.5.1 arm 64) against CMU-1.ndpi which is an example of format using the TurboJPEG library

sbesson@Sebastien-GS-MacBook-Pro-2025 bioformats2raw % unzip -q build/distributions/bioformats2raw-0.13.0-SNAPSHOT.zip
sbesson@Sebastien-GS-MacBook-Pro-2025 bioformats2raw % ls bioformats2raw-0.13.0-SNAPSHOT/lib | grep turbo
libjpeg-turbo-0.1.0-SNAPSHOT.jar
sbesson@Sebastien-GS-MacBook-Pro-2025 bioformats2raw % ./bioformats2raw-0.13.0-SNAPSHOT/bin/bioformats2raw ~/Downloads/CMU-1.ndpi ~/Downloads/CMU-1.zarr -p
[0/0] 100% [=====================================================================================================================] 5700/5700 (0:00:30 / 0:00:00) 
[0/1] 100% [=====================================================================================================================] 1425/1425 (0:00:06 / 0:00:00) 
[0/2] 100% [=======================================================================================================================] 390/390 (0:00:01 / 0:00:00) 
[0/3] 100% [=======================================================================================================================] 105/105 (0:00:00 / 0:00:00) 
[0/4] 100% [=========================================================================================================================] 36/36 (0:00:00 / 0:00:00) 
[0/5] 100% [=========================================================================================================================] 12/12 (0:00:00 / 0:00:00) 
[0/6] 100% [===========================================================================================================================] 3/3 (0:00:00 / 0:00:00) 
[0/7] 100% [===========================================================================================================================] 3/3 (0:00:00 / 0:00:00) 
[0/8] 100% [===========================================================================================================================] 3/3 (0:00:00 / 0:00:00) 
[1/0] 100% [===========================================================================================================================] 6/6 (0:00:00 / 0:00:00) 
[1/1] 100% [===========================================================================================================================] 3/3 (0:00:00 / 0:00:00) 
[1/2] 100% [===========================================================================================================================] 3/3 (0:00:00 / 0:00:00) 
[1/3] 100% [===========================================================================================================================] 3/3 (0:00:00 / 0:00:00)

@melissalinkert melissalinkert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anything concerning in the diff. I tested including the snapshot in bioformats2raw as described, and could successfully convert CMU-1.ndpi on Windows and Linux as expected.

Discussed separately with @sbesson that getting the publication workflow to run correctly still requires some configuration, but defer to @chris-allan on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prepare for integration in Bio-Formats

3 participants