Skip to content

Commit 6940d2c

Browse files
Applied review comments
1 parent c564eda commit 6940d2c

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +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.66"
56
}
67

78
repositories {
@@ -10,7 +11,7 @@ repositories {
1011

1112
dependencies {
1213
implementation 'org.owasp:dependency-check-gradle:10.0.3'
13-
14+
implementation 'org.apache.maven:maven-artifact:4.0.0-rc-4'
1415
compileOnly 'org.projectlombok:lombok:1.18.38'
1516
annotationProcessor 'org.projectlombok:lombok:1.18.38'
1617

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
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;
@@ -22,7 +23,7 @@ public class CheckstyleSetup extends DefaultTask {
2223

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

2728
public static void apply(Project project) {
2829
project.getPlugins().apply(CheckstylePlugin.class);
@@ -39,9 +40,9 @@ public static void apply(Project project) {
3940
if (checkstyleTask.getConfigFile() == null || !checkstyleTask.getConfigFile().exists()) {
4041
// If using bundled checkstyle config, set a floor for checkstyle version since older versions may
4142
// not support our bundled config.
42-
if (VersionNumber.parse(minCheckstyleVersion)
43-
.compareTo(VersionNumber.parse(ext.getToolVersion())) > 0) {
44-
ext.setToolVersion(minCheckstyleVersion);
43+
ComparableVersion currentCheckStyleVersion = new ComparableVersion(ext.getToolVersion());
44+
if (minCheckstyleVersion.compareTo(currentCheckStyleVersion) > 0) {
45+
ext.setToolVersion(ext.getToolVersion());
4546
}
4647

4748
checkstyleTask.setConfigFile(writer.configFile);

0 commit comments

Comments
 (0)