All checks were successful
continuous-integration/drone/push Build is passing
Centralized dependency versions into `ext` block for easier upgrades. Enhanced test task with parallel execution, fail-fast behavior, and improved logging. Updated JaCoCo settings, introduced `gradle.properties` for build optimizations, and adjusted `bootJar`/`jar` tasks for cleaner outputs.
105 lines
3.0 KiB
Groovy
105 lines
3.0 KiB
Groovy
plugins {
|
|
id 'java'
|
|
id 'org.springframework.boot' version '3.3.3'
|
|
id 'io.spring.dependency-management' version '1.1.5'
|
|
id 'jacoco'
|
|
}
|
|
|
|
group = 'se.urmo'
|
|
version = '0.0.1-SNAPSHOT'
|
|
|
|
java {
|
|
toolchain {
|
|
languageVersion = JavaLanguageVersion.of(21)
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
ext {
|
|
// Pin Flyway to a PG16-compatible version that aligns with Spring Boot 3.3.x
|
|
set('flyway.version', '10.17.3')
|
|
lombokVersion = '1.18.32'
|
|
springdocVersion = '2.6.0'
|
|
h2Version = '2.2.224'
|
|
pgJdbcVersion = '42.7.4'
|
|
}
|
|
|
|
dependencies {
|
|
// --- Spring starters ---
|
|
implementation 'org.springframework.boot:spring-boot-starter-web'
|
|
implementation 'org.springframework.boot:spring-boot-starter-validation'
|
|
implementation 'org.springframework.boot:spring-boot-starter-security'
|
|
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
|
|
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
|
implementation 'org.springframework.boot:spring-boot-starter-actuator'
|
|
|
|
// --- OpenAPI (Swagger UI) ---
|
|
implementation "org.springdoc:springdoc-openapi-starter-webmvc-ui:${springdocVersion}"
|
|
|
|
// --- DB / migrations ---
|
|
runtimeOnly "org.postgresql:postgresql:${pgJdbcVersion}"
|
|
implementation 'org.flywaydb:flyway-core' // version from ext.flyway.version
|
|
implementation 'org.flywaydb:flyway-database-postgresql' // PG support module
|
|
|
|
// --- Lombok ---
|
|
compileOnly "org.projectlombok:lombok:${lombokVersion}"
|
|
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
|
|
testCompileOnly "org.projectlombok:lombok:${lombokVersion}"
|
|
testAnnotationProcessor "org.projectlombok:lombok:${lombokVersion}"
|
|
|
|
// --- Test ---
|
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
|
testImplementation 'org.springframework.security:spring-security-test'
|
|
testImplementation 'com.jayway.jsonpath:json-path:2.9.0'
|
|
testRuntimeOnly "com.h2database:h2:${h2Version}" // used by application-test.yml
|
|
}
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
options.encoding = 'UTF-8'
|
|
options.release = 21
|
|
}
|
|
|
|
tasks.test {
|
|
useJUnitPlatform()
|
|
|
|
// ⚡ parallelize tests a bit without overloading CI runners
|
|
def cores = Runtime.runtime.availableProcessors()
|
|
maxParallelForks = Math.max(1, (int)(cores / 2))
|
|
|
|
// Fail fast to shorten CI feedback on red builds
|
|
failFast = true
|
|
|
|
testLogging {
|
|
events "FAILED", "SKIPPED"
|
|
exceptionFormat "short"
|
|
showCauses true
|
|
showExceptions true
|
|
}
|
|
|
|
finalizedBy tasks.jacocoTestReport
|
|
}
|
|
|
|
jacoco {
|
|
toolVersion = "0.8.10"
|
|
}
|
|
|
|
tasks.jacocoTestReport {
|
|
dependsOn tasks.test
|
|
reports {
|
|
xml.required = true // useful for CI
|
|
html.required = true
|
|
}
|
|
}
|
|
|
|
tasks.bootJar {
|
|
// if you later add a versioning scheme, you can also inject build info here
|
|
archiveFileName = "hemhub-api.jar"
|
|
}
|
|
|
|
tasks.jar {
|
|
enabled = false // Spring Boot builds fat jar via bootJar
|
|
}
|