Provides 2 plugins that configure plugins and apply common build logic, and a set of starters that provide individual pieces of common functionality.
A general purpose Java plugin for LAA CCMS projects.
- apply Java plugin, and configure a Java toolchain.
- apply Jacoco plugin, and configure sensible defaults.
- apply Versions plugin, and configure the recommended versioning strategy.
- apply Checkstyle plugin, and configure sensible defaults.
- apply Test Logger plugin for better readability of test outputs.
- apply Maven Publish plugin, and configure LAA CCMS repositories and credential resolution for local development and pipelines. For publishing, the repository name can be overridden by setting the
repositoryName
property in yourgradle.properties
. This is helpful when your repository name is different from your project name. - apply Gradle Release plugin, and define a release tag format.
In addition to this an integrationTest
gradle task will be provided, that will run tests under src/main/integrationTest
. All test tasks will also output increased logging (standard streams and stack traces) to aid with debugging.
plugins {
id 'uk.gov.laa.ccms.laa-ccms-java-gradle-plugin' version '<latest>'
}
A SpringBoot convention plugin for LAA CCMS projects. All of the above + SpringBoot dependency version recommendations to simplify dependency management and avoid compatibility issues within a project.
- apply the LAA CCMS Java Gradle plugin
- apply the SpringBoot plugin
- apply the Dependency Management plugin, and configure dependency management for the common LAA CCMS Spring Boot components (starters & libraries)
plugins {
id 'uk.gov.laa.ccms.laa-ccms-spring-boot-gradle-plugin' version '<latest>'
}
For the plugins to work in your project, you will need to configure the plugin repository and provide your GitHub credentials in your local gradle.properties
file.
To configure the plugin repository, add this to the top your project's settings.gradle
:
pluginManagement {
repositories {
maven {
name = "gitHubPackages"
url uri('https://maven.pkg.github.com/ministryofjustice/laa-ccms-spring-boot-common')
credentials {
username = System.getenv("GITHUB_ACTOR")?.trim() ?: settings.ext.find('project.ext.gitPackageUser')
password = System.getenv("GITHUB_TOKEN")?.trim() ?: settings.ext.find('project.ext.gitPackageKey')
}
}
maven { url "https://plugins.gradle.org/m2/" }
gradlePluginPortal()
}
}
This tells Gradle where to search for plugins. The plugins in this repository are published to GitHub packages, under the same namespace. For further information see Working with the Gradle registry.
Your credentials to the GitHub Packages repository need to be defined in your local gradle.properties
file, which you can find in your home directory, e.g. ~/.gradle/gradle.properties
.
Before doing this, ensure you have created a personal access token
in GitHub and configured it with repo
, write:packages
and read:packages
access. The token must also be authorized with (MoJ) SSO.
Once you have your personal access token, please add the following parameters to ~/.gradle/gradle.properties
:
project.ext.gitPackageUser = <your GitHub username>
project.ext.gitPackageKey = <your GitHub access token>
Do not include '
or "
around your username or token as these are treated literally as part of the value by gradle.
In your (root) build.gradle
, add the plugin dependency via the Gradle Plugin DSL, e.g:
plugins {
id 'uk.gov.laa.ccms.springboot.laa-ccms-spring-boot-gradle-plugin' version '<LATEST>' apply false
}
Where <LATEST>
is the latest release version found here.
If this is not a multi-project build, you can remove apply false
to apply the plugin at the root level. Otherwise, in your subprojects where the plugin is required you will need to apply the plugin:
apply plugin: 'uk.gov.laa.ccms.springboot.laa-ccms-spring-boot-gradle-plugin'
-
[TODO] Exception Handling
-
[TODO] Entity Converters