Skip to content

Git Version Plugin Publishing

This guide explains how to publish the Git Version Plugin either to Maven Local (for testing) or to the Gradle Plugin Portal (for distribution).


Setup Gradle Plugin Portal Credentials

You need to provide your Gradle Plugin Portal API keys.
Add the following inside your ~/.gradle/gradle.properties file (machine-wide, not in the project repo):

gradle.publish.key=YOUR_KEY
gradle.publish.secret=YOUR_SECRET

Replace YOUR_KEY and YOUR_SECRET with the values you can get these keys from your Gradle Plugin Portal account.

Publishing Tasks

1. Publish to Maven Local (for testing)

./gradlew publishToMavenLocal

This will install the plugin into your local Maven repository (usually ~/.m2/repository). You can then use it in a sample project with:

plugins {
    id("io.github.kansalmohit19.git-version") version "X.Y.Z"
}

and add:

pluginManagement {
    repositories {
        mavenLocal()
        gradlePluginPortal()
    }
}

2. Publish to Gradle Plugin Portal

./gradlew publishPlugins

This uploads the plugin to the official Gradle Plugin Portal. Once published, others can use it with:

plugins {
    id("io.github.kansalmohit19.git-version") version "X.Y.Z"
}