Page history Edit this page How do I edit this website?
Original MediaWiki page


The content of this page has not been vetted since shifting away from MediaWiki. If you’d like to help, check out the how to help guide!

Gradle is an open-source build system using a Groovy-based script syntax as a succinct alternative to the XML of Ant or Maven.

QuPath for instance uses gradle, and if you want to develop an extension for QuPath, you will most probably need to use gradle instead of maven.

Deploying on Scijava Maven using Gradle and GitHub actions

Any maven project depending on pom-scijava can be deployed on scijava maven pretty easily using scijava-scripts. See Maven and GitHub actions for more information.

If, for some reason, you have a gradle managed project instead of a maven project (for a QuPath extension for instance), it’s nonetheless possible to upload it to scijava maven, with some limitations.

Warning most probably transitive dependencies will not be handled correctly if you mix maven and gradle projects.

Requirements for maven deployment

Suppose that you have a gradle project with minimal dependencies and you want to upload the resulting built jar to scijava maven. First you need to host your project on github, and your github organisation needs to be allowed to deploy on scijava maven:

Then you need to amend your build script and add a github workflow, as specified below:

Setting up scripts: build.gradle file and GitHub publish.yml

You will need to make a few modifications to your build.gradle file.

Warning: examples below are written in kotlin instead of groovy (help needed for translation…)

build.gradle file

Make sure that the following parts are present in your build.gradle file:

  • Specify a group and version to your artifact, for instance:
    group = "ch.epfl.biop"
    version = "0.2.3-SNAPSHOT"
  • (The artifact name is defined in the settings.gradle file), for instance:
    # ! KOTLIN LANGUAGE ! = "qupath-extension-warpy"

    Leading, in this example to the GAV: ch.epfl.biop:qupath-extension-warpy:0.2.3-SNAPSHOT, which you want to deploy.

  • Declare the maven-publish plugin:
    plugins {
  • Add publishing settings:

publishing {
    publications.create<MavenPublication>("maven") {
    repositories {
        maven {
            name = "scijava"
            url = if (version.toString().endsWith("SNAPSHOT"))
            else uri("")
            credentials {
                username = System.getenv("MAVEN_USER")
                password = System.getenv("MAVEN_PASS")

publish.yml Github workflow

Second you can add in your project within the folder .github/workflows the script publish.yml:

# This workflow will publish jars to
# Currently, it must be triggered manually and uses Java 11
# (because there is no requirement for jpackage).

name: Publish release to SciJava Maven


    runs-on: ubuntu-latest
      - uses: actions/checkout@v2
      - uses: actions/setup-java@v2
          java-version: '11'
          distribution: 'adopt-hotspot'
      - name: Grant execute permission for gradlew
        run: chmod +x gradlew
      - name: Publish package
        run: ./gradlew publish -P toolchain=11 -P release=true
          MAVEN_USER: $ { { secrets.MAVEN_USER } }
          MAVEN_PASS: $ { { secrets.MAVEN_PASS } }

To deploy, you can run the workflow ‘manually’ from github. Click actions, select the publish workflow, and hit run. If everything is successful, your new repository should appear on scijava maven. If not, check the log of the github workflow, and if you do not find the issue, post an issue on the Forum with the failing log!

Naming your versions!

You can put a -SNAPSHOT suffix to your repo to deploy a snapshot version of it. To make a release, commit the repo without the SNAPSHOT suffix, run the publish workflow, then immediately make a new commit with a higher version and a SNAPSHOT version. All of this is automated with scijava-scripts, but you currently have to do it manually with gradle projects.

Example of developpement:

  • initial commit > > publish snapshot
  • commit “add stuff” >
  • commit “add a fancy feature” > > publish snapshot ( because you want to erase the previous snapshot)
  • commit “small fix” >
  • commit “release v0.1.0, remove SNAPSHOT suffix” > > publish 0.1.0 release
  • commit “bumps to next development cycle, adds SNAPSHOT suffix 0.1.1-SNAPSHOT” > > publish 0.1.1-SNAPSHOT
  • and so on.

You will need to change the version number manually, and also run the github publish workflow manually.


If you want to see a project which uses all of this, have a look at

Consuming ImageJ artifact in a Gradle build.gradle script

The ImageJ core artifacts are built with Maven, but can also be consumed in a Gradle build script.

Contributed1 by Ryan Eckbo

buildscript {
    repositories {
        maven {
            url ""
    dependencies {
        classpath "io.spring.gradle:dependency-management-plugin:0.5.4.RELEASE"
apply plugin: "io.spring.dependency-management"

repositories {
    maven {
            url ""
dependencyManagement {
    imports {
        mavenBom 'net.imagej:pom-imagej:14.1.0'

dependencies {
    compile 'net.imagej:imagej'