diff --git a/README.md b/README.md index a2bacd39..69a9e14b 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ The template is a working application with a minimal setup. It contains: * application skeleton * setup script to prepare project * common plugins and libraries + * [HMCTS Java plugin](https://github.com/hmcts/gradle-java-plugin) * docker setup * automatically publishes API documentation to [hmcts/cnp-api-docs](https://github.com/hmcts/cnp-api-docs) * code quality tools already set up @@ -25,19 +26,26 @@ The application exposes health endpoint (http://localhost:4550/health) and metri The template contains the following plugins: - * checkstyle + * HMCTS Java plugin - https://docs.gradle.org/current/userguide/checkstyle_plugin.html + Applies code analysis tools with HMCTS default settings. See the [project repository](https://github.com/hmcts/gradle-java-plugin) for details. - Performs code style checks on Java source files using Checkstyle and generates reports from these checks. - The checks are included in gradle's *check* task (you can run them by executing `./gradlew check` command). + Analysis tools include: - * pmd + * checkstyle - https://docs.gradle.org/current/userguide/pmd_plugin.html + https://docs.gradle.org/current/userguide/checkstyle_plugin.html - Performs static code analysis to finds common programming flaws. Included in gradle `check` task. + Performs code style checks on Java source files using Checkstyle and generates reports from these checks. + The checks are included in gradle's *check* task (you can run them by executing `./gradlew check` command). + * org.owasp.dependencycheck + + https://jeremylong.github.io/DependencyCheck/dependency-check-gradle/index.html + + Provides monitoring of the project's dependent libraries and creating a report + of known vulnerable components that are included in the build. To run it + execute `gradle dependencyCheck` command. * jacoco @@ -66,13 +74,6 @@ The template contains the following plugins: Reduces the amount of work needed to create a Spring application - * org.owasp.dependencycheck - - https://jeremylong.github.io/DependencyCheck/dependency-check-gradle/index.html - - Provides monitoring of the project's dependent libraries and creating a report - of known vulnerable components that are included in the build. To run it - execute `gradle dependencyCheck` command. * com.github.ben-manes.versions diff --git a/build.gradle b/build.gradle index f140b42c..656c774a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,15 @@ plugins { id 'application' - id 'checkstyle' - id 'pmd' id 'jacoco' id 'io.spring.dependency-management' version '1.1.4' id 'org.springframework.boot' version '3.2.0' - id 'org.owasp.dependencycheck' version '9.0.9' id 'com.github.ben-manes.versions' version '0.51.0' id 'org.sonarqube' version '4.4.1.3373' + /* + Applies analysis tools including checkstyle and OWASP Dependency checker. + See https://github.com/hmcts/gradle-java-plugin + */ + id 'uk.gov.hmcts.java' version '0.12.56' } group = 'uk.gov.hmcts.reform' @@ -101,21 +103,6 @@ task smoke(type: Test) { classpath = sourceSets.smokeTest.runtimeClasspath } -checkstyle { - maxWarnings = 0 - toolVersion = '10.13.0' - getConfigDirectory().set(new File(rootDir, 'config/checkstyle')) -} - -pmd { - toolVersion = "6.55.0" - sourceSets = [sourceSets.main, sourceSets.test, sourceSets.functionalTest, sourceSets.integrationTest, sourceSets.smokeTest] - reportsDir = file("$project.buildDir/reports/pmd") - // https://github.com/pmd/pmd/issues/876 - ruleSets = [] - ruleSetFiles = files("config/pmd/ruleset.xml") -} - jacocoTestReport { executionData(test, integration) reports { @@ -149,25 +136,7 @@ dependencyUpdates { // https://jeremylong.github.io/DependencyCheck/dependency-check-gradle/configuration.html dependencyCheck { - // Specifies if the build should be failed if a CVSS score above a specified level is identified. - // range of 0-10 fails the build, anything greater and it doesn't fail the build - failBuildOnCVSS = 0 suppressionFile = 'config/owasp/suppressions.xml' - - analyzers { - // Disable scanning of .NET related binaries - assemblyEnabled = false - } - skipConfigurations = [ - "checkstyle", - "compileOnly", - "pmd", - "integrationTest", - "functionalTest", - "smokeTest", - "contractTestRuntimeClasspath", - "contractTestCompileClasspath" - ] } repositories { diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml deleted file mode 100644 index df6ac304..00000000 --- a/config/checkstyle/checkstyle.xml +++ /dev/null @@ -1,251 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/config/pmd/ruleset.xml b/config/pmd/ruleset.xml deleted file mode 100644 index 023ce92b..00000000 --- a/config/pmd/ruleset.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - HMCTS PMD rule set - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -