Home

Awesome

Java Convention Gradle Plugin

Maven Central

Defines the Java conventions I use in my projects.

Usage

Apply it with:

plugins {
 id "se.bjurr.gradle.java-convention" version "X"
}

It can be tweaked in gradle.properties with some properties, the plugin reads them like this:

// ---- default config ----
// mainClass: se.bjurr.violations.main.Main
mainClass: project.getProperties().getOrDefault("mainClass", ""),
sourceCompatibility: project.getProperties().getOrDefault("sourceCompatibility", "17"),
targetCompatibility: project.getProperties().getOrDefault("targetCompatibility", "17"),
maxViolations: Integer.parseInt(project.getProperties().getOrDefault("maxViolations", "0")),
formattingExcludedPatterns: project.getProperties().getOrDefault("formattingExcludedPatterns", "**/gen/**,**/generated/**,**/generated-source/**"),
generatedSourceFolders: project.getProperties().getOrDefault("generatedSourceFolders", "src/gen/java,src/generated/java"),
extraTestSourceFolders: project.getProperties().getOrDefault("extraTestSourceFolders", "src/test/generated"),
jarResourcesFolder: project.getProperties().getOrDefault("jarResourcesFolder", "src/jar/resources"),
useViolations: project.getProperties().getOrDefault("useViolations", "true") == "true",
// ---- default config ----

Works great with https://github.com/tomasbjerre/conventional-release-gradle-plugin