Add infrastructure to publish library to Maven Central#7
Conversation
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
|
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 The published SNAPSHOT has been consumed in a loca build of 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 |
melissalinkert
left a comment
There was a problem hiding this comment.
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.
This adds the infrastructure to publish this library to Maven Central and fixes #2
Build changes:
com.glencoesoftwareto match the namespace in Maven Centraljreleaserconfiguration is added tobuild.gradleas 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 SNAPSHOTSjar-pack.shutility is refactored to copy the pre-compiled libraries undersrc/main/resourcesallowing./gradlew jarto automatically bundle them in the packaged libraryGitHub actions changes:
windows-2022as the latest image is using Visual Studio 2026 and is incompatible with the CMake requirements of the 1.x library - see [Windows]windows-latestandwindows-2025image-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 buildlibjpeg-turbo 3.xjar-pack.shlogic before running the./gradlew buildtarget