Skip to content

jonloucks/gradle-kit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

48 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Gradle Kit

A collection of Gradle plugins that streamline Java project development and publication to Maven Central Repository via Sonatype.

Overview

Gradle Kit provides four convention plugins designed to simplify CI/CD workflows for Java projects. These plugins automatically configure standard Gradle functionality with sensible defaults while allowing customization through environment variables, system properties, or project properties.

Key Features:

  • Automatic configuration of Java compiler versions and toolchains
  • Integrated code quality tools (JaCoCo, SpotBugs, Javadoc)
  • Simplified Maven Central publishing via Sonatype's new API
  • In-memory GPG signing for secure CI/CD pipelines
  • CI/CD optimized with GitHub Actions support
  • Flexible configuration via environment variables or project properties

Plugins

java-kit

Java Kit Plugin

Extends Gradle's standard java plugin with automatic configuration for modern Java projects.

Features:

  • Automatically applies the java plugin
  • Configures Java compiler, source, and target versions (default: Java 17)
  • Integrates JaCoCo for code coverage reporting
  • Adds SpotBugs for static analysis
  • Configures Javadoc generation with modern styling
  • Supports version tagging for releases
  • Supports environment variable, system property, and project property overrides

Usage:

plugins {
    id 'io.github.jonloucks.java-kit' version '1.2.2'
}
java-library-kit

Java Library Kit Plugin

Extends Gradle's java-library plugin with the same automatic configuration as java-kit, optimized for library projects.

Features:

  • Automatically applies the java-library plugin
  • Configures Java compiler, source, and target versions (default: Java 17)
  • Integrates JaCoCo for code coverage reporting
  • Adds SpotBugs for static analysis
  • Configures Javadoc generation with modern styling
  • Supports version tagging for releases
  • Supports environment variable, system property, and project property overrides

Usage:

plugins {
    id 'io.github.jonloucks.java-library-kit' version '1.2.2'
}
maven-publish-kit

Maven Publish Kit Plugin

Simplifies publishing to Maven Central Repository via Sonatype's new Central Publishing API.

Features:

  • Automatically applies the maven-publish plugin
  • Creates staging repositories for deployments
  • Generates publication bundles for Sonatype Central
  • Uploads bundles via REST API to https://central.sonatype.com/publishing
  • Configures checksums and metadata
  • Supports environment variable, system property, and project property overrides

Usage:

plugins {
    id 'io.github.jonloucks.maven-publish-kit' version '1.2.2'
}

Tasks:

  • createPublisherBundle - Creates a ZIP bundle of all publications
  • uploadPublisherBundle - Uploads the bundle to Sonatype Central
signing-kit

Signing Kit Plugin

Handles GPG signing for Maven publications using in-memory keys, ideal for CI/CD environments.

Features:

  • Automatically applies the signing plugin
  • Uses in-memory PGP keys for secure signing in CI/CD
  • No need to store keyring files on build servers
  • Supports environment variable, system property, and project property overrides

Usage:

plugins {
    id 'io.github.jonloucks.signing-kit' version '1.2.2'
}

Configuration: Provide GPG credentials via environment variables:

  • KIT_GPG_SECRET_KEY - ASCII-armored private key
  • KIT_GPG_SECRET_KEY_PASSWORD - Key password

Quick Start

For Application Projects

plugins {
    id 'io.github.jonloucks.java-kit' version '1.2.2'
    id 'io.github.jonloucks.maven-publish-kit' version '1.2.2'
    id 'io.github.jonloucks.signing-kit' version '1.2.2'
}

For Library Projects

plugins {
    id 'io.github.jonloucks.java-library-kit' version '1.2.2'
    id 'io.github.jonloucks.maven-publish-kit' version '1.2.2'
    id 'io.github.jonloucks.signing-kit' version '1.2.2'
}

CI/CD Example (GitHub Actions)

- name: Build and Publish
  run: ./gradlew check jacocoTestReport publish createPublisherBundle uploadPublisherBundle
  env:
    KIT_PROJECT_WORKFLOW: 'main-release'
    KIT_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
    KIT_GPG_SECRET_KEY_PASSWORD: ${{ secrets.GPG_SECRET_KEY_PASSWORD }}
    KIT_OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
    KIT_OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}

Badges

OpenSSF Best Practices Coverage Badge Javadoc Badge

About

Gradle plugins and scripts for publishing Java projects Maven Central

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages