Skip to content

Commit 5d2c2d4

Browse files
Merge pull request #310 from hmcts/gradle-9-support
Added support for gradle 9
2 parents d63b019 + 6d66984 commit 5d2c2d4

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# HMCTS Gradle Java Plugin ![Java CI](https://github.com/hmcts/gradle-java-plugin/workflows/Java%20CI/badge.svg) ![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/hmcts/gradle-java-plugin?label=release)
1+
# HMCTS Gradle Java Plugin ![Java CI](https://github.com/hmcts/gradle-java-plugin/workflows/Java%20CI/badge.svg) ![GitHub tag (latest SemVer)](https://img.shields.io/github/v/release/hmcts/gradle-java-plugin)
22

33
Applies and configures a standard set of code analysis tools for use in HMCTS Java projects.
44

build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ plugins {
22
id 'java-gradle-plugin'
33
id 'groovy'
44
id 'com.gradle.plugin-publish' version '1.3.1'
5-
id "uk.gov.hmcts.java" version "0.12.65"
5+
id "uk.gov.hmcts.java" version "0.12.66"
66
}
77

88
repositories {
@@ -11,9 +11,9 @@ repositories {
1111

1212
dependencies {
1313
implementation 'org.owasp:dependency-check-gradle:10.0.3'
14-
14+
implementation 'org.apache.maven:maven-artifact:3.9.10'
1515
compileOnly 'org.projectlombok:lombok:1.18.38'
16-
annotationProcessor 'org.projectlombok:lombok:1.18.38'
16+
annotationProcessor 'org.projectlombok:lombok:1.18.38'
1717

1818
testImplementation group: 'com.google.guava', name: 'guava', version: '33.4.8-jre'
1919
testImplementation group: 'commons-io', name: 'commons-io', version: '2.19.0'
@@ -32,8 +32,8 @@ compileJava {
3232

3333
def version = System.getenv("RELEASE_VERSION")?.replace("refs/tags/", "") ?: "DEV-SNAPSHOT"
3434

35-
group 'uk.gov.hmcts.reform'
36-
project.version version
35+
group = 'uk.gov.hmcts.reform'
36+
project.version = version
3737

3838
gradlePlugin {
3939
// Define the plugin
@@ -58,7 +58,7 @@ sourceSets {
5858
gradlePlugin.testSourceSets(sourceSets.integrationTest)
5959
configurations.integrationTestImplementation.extendsFrom(configurations.testImplementation)
6060

61-
task integrationTest(type: Test) {
61+
tasks.register('integrationTest', Test) {
6262
testClassesDirs = sourceSets.integrationTest.output.classesDirs
6363
classpath = sourceSets.integrationTest.runtimeClasspath
6464
}

src/main/java/uk/gov/hmcts/tools/CheckstyleSetup.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package uk.gov.hmcts.tools;
22

33
import lombok.SneakyThrows;
4+
import org.apache.maven.artifact.versioning.ComparableVersion;
45
import org.gradle.api.DefaultTask;
56
import org.gradle.api.Project;
67
import org.gradle.api.plugins.quality.Checkstyle;
78
import org.gradle.api.plugins.quality.CheckstyleExtension;
89
import org.gradle.api.plugins.quality.CheckstylePlugin;
910
import org.gradle.api.tasks.TaskAction;
10-
import org.gradle.util.VersionNumber;
1111

1212
import java.io.BufferedWriter;
1313
import java.io.File;
@@ -22,7 +22,7 @@ public class CheckstyleSetup extends DefaultTask {
2222

2323
// Recent checkstyle versions flag an annotation array indentation which is widely used at HMCTS.
2424
// Consequently we don't force recent versions onto teams (but they may opt in).
25-
public static final String minCheckstyleVersion = "8.31";
25+
public static final ComparableVersion minCheckstyleVersion = new ComparableVersion("8.31");
2626

2727
public static void apply(Project project) {
2828
project.getPlugins().apply(CheckstylePlugin.class);
@@ -39,9 +39,9 @@ public static void apply(Project project) {
3939
if (checkstyleTask.getConfigFile() == null || !checkstyleTask.getConfigFile().exists()) {
4040
// If using bundled checkstyle config, set a floor for checkstyle version since older versions may
4141
// not support our bundled config.
42-
if (VersionNumber.parse(minCheckstyleVersion)
43-
.compareTo(VersionNumber.parse(ext.getToolVersion())) > 0) {
44-
ext.setToolVersion(minCheckstyleVersion);
42+
ComparableVersion currentCheckStyleVersion = new ComparableVersion(ext.getToolVersion());
43+
if (minCheckstyleVersion.compareTo(currentCheckStyleVersion) > 0) {
44+
ext.setToolVersion(ext.getToolVersion());
4545
}
4646

4747
checkstyleTask.setConfigFile(writer.configFile);

0 commit comments

Comments
 (0)