Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 74 additions & 36 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,56 +1,94 @@
plugins {
id 'application'
id 'java'
alias(libs.plugins.spring.boot)
alias(libs.plugins.spring.dependency.management)
id 'org.springframework.boot' version '4.0.0'
id 'io.spring.dependency-management' version '1.1.7'
id 'jacoco'
id 'maven-publish'
alias(libs.plugins.ben.manes.versions)
alias(libs.plugins.cyclonedx.bom)
alias(libs.plugins.gradle.git.properties)
alias(libs.plugins.avast.docker.compose)
id 'com.github.ben-manes.versions' version '0.53.0'
id 'org.cyclonedx.bom' version '2.4.1'
id 'com.gorylenko.gradle-git-properties' version '2.5.3'
id 'com.avast.gradle.docker-compose' version '0.17.12'
}

group = 'uk.gov.hmcts.cp'
version = System.getProperty('ARTEFACT_VERSION') ?: '0.0.999'

apply {
from("$rootDir/gradle/dependencies/java-core.gradle")
from("$rootDir/gradle/dependencies/spring-core.gradle")
from("$rootDir/gradle/dependencies/spring-db.gradle")

from("$rootDir/gradle/github/repositories.gradle")
from("$rootDir/gradle/github/java.gradle")
from("$rootDir/gradle/github/dependency.gradle")
from("$rootDir/gradle/github/pmd.gradle")
from("$rootDir/gradle/github/test.gradle")
from("$rootDir/gradle/github/jar.gradle")

from("$rootDir/gradle/tasks/api-test.gradle")
}
from("$rootDir/gradle/repositories.gradle")
from("$rootDir/gradle/java.gradle")
from("$rootDir/gradle/dependency.gradle")
from("$rootDir/gradle/pmd.gradle")
from("$rootDir/gradle/test.gradle")
from("$rootDir/gradle/jar.gradle")

springBoot {
buildInfo {
properties {
name = project.name
version = project.version.toString()
}
}
from("$rootDir/gradle/api-test.gradle")
}

// We MUST keep all dependencies in the build.gradle to allow dependabot to provide version updates
// Sadly, dependabot does not track dependencies in the apply-from files
dependencies {
implementation libs.hmcts.crime.template
// Api spec
implementation("uk.gov.hmcts.cp:api-hmcts-crime-template:2.0.2")
implementation 'io.swagger.core.v3:swagger-core:2.2.36'


// Java core
implementation 'net.logstash.logback:logstash-logback-encoder:8.1'
implementation 'org.apache.logging.log4j:log4j-to-slf4j'
implementation 'ch.qos.logback:logback-classic'
implementation 'ch.qos.logback:logback-core'
implementation 'org.owasp.encoder:encoder:1.2.3'

compileOnly 'org.projectlombok:lombok:1.18.38'
annotationProcessor 'org.projectlombok:lombok:1.18.38'
testCompileOnly 'org.projectlombok:lombok:1.18.38'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.38'

implementation 'org.mapstruct:mapstruct:1.5.5.Final'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.5.Final'


// Spring boot core
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-aspectj'
testImplementation "org.springframework.boot:spring-boot-starter-webmvc-test"
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'junit', module: 'junit'
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}


// Spring boot database / postgres
//
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.postgresql:postgresql'
implementation 'org.springframework.boot:spring-boot-starter-flyway'
implementation 'org.flywaydb:flyway-core'
implementation 'org.flywaydb:flyway-database-postgresql'
testImplementation("org.springframework.boot:spring-boot-testcontainers:4.0.0")
testImplementation 'org.testcontainers:postgresql:1.21.3'
testImplementation 'org.testcontainers:junit-jupiter:1.21.3'


// --- Observability / Actuator / OTEL / Prometheus ---
implementation libs.spring.boot.starter.actuator
implementation libs.hibernate.validator
implementation libs.spring.boot.starter.opentelemetry
implementation libs.jjwt
testRuntimeOnly libs.junit.platform.launcher
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.hibernate.validator:hibernate-validator'
implementation 'org.springframework.boot:spring-boot-starter-opentelemetry'

// Should come in with the api
implementation libs.swagger.core

testImplementation(platform(libs.junit.bom))
testRuntimeOnly libs.junit.jupiter.engine
// Jwt token
implementation 'io.jsonwebtoken:jjwt:0.13.0'


// Api Test
apiTestImplementation platform('org.junit:junit-bom:5.13.4')
apiTestRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
apiTestImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'junit', module: 'junit'
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
apiTestRuntimeOnly 'org.junit.platform:junit-platform-launcher'
apiTestCompileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.38'
apiTestAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.38'
}
13 changes: 0 additions & 13 deletions gradle/tasks/api-test.gradle → gradle/api-test.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,6 @@ configurations {
}
}

dependencies {
apiTestImplementation platform(libs.junit.bom)
apiTestRuntimeOnly libs.junit.jupiter.engine

apiTestImplementation(libs.spring.boot.starter.test) {
exclude group: 'junit', module: 'junit'
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
apiTestRuntimeOnly libs.junit.platform.launcher
apiTestCompileOnly libs.lombok
apiTestAnnotationProcessor libs.lombok
}

dockerCompose {
useComposeFiles = ['docker-compose.yml']
startedServices = ['app', 'db']
Expand Down
19 changes: 0 additions & 19 deletions gradle/dependencies/java-core.gradle

This file was deleted.

11 changes: 0 additions & 11 deletions gradle/dependencies/spring-core.gradle

This file was deleted.

10 changes: 0 additions & 10 deletions gradle/dependencies/spring-db.gradle

This file was deleted.

File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions gradle/github/java.gradle → gradle/java.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,16 @@ tasks.withType(JavaCompile).configureEach {
tasks.withType(JavaExec).configureEach {
javaLauncher.set(javaToolchains.launcherFor(java.toolchain))
}

tasks.named('wrapper') {
delete "${projectDir}/gradlew.bat"
}

springBoot {
buildInfo {
properties {
name = project.name
version = project.version.toString()
}
}
}
55 changes: 0 additions & 55 deletions gradle/libs.versions.toml

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 3 additions & 0 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
<appender name="JSON" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
<providers>
<mdc/>
<timestamp>
<fieldName>timestamp</fieldName>
<pattern>yyyy-MM-dd' 'HH:mm:ss.SSS</pattern>
</timestamp>
<loggerName/>
<threadName/>
<logLevel/>
<!-- Lets keep the message to the left so its easier to find without scrolling -->
<pattern>
<pattern>{"message": "%message%n%xException{full}"}</pattern>
</pattern>
<mdc/>
<loggerName/>
<threadName/>
<logLevel/>
</providers>
</encoder>
</appender>
Expand Down
Loading