@@ -3,64 +3,98 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent
33
44plugins {
55 application
6- // "checkstyle"
7- id(" io.freefair.lombok" ) version " 8.11"
8- id(" org.springframework.boot" ) version " 3.3.5"
9- id(" io.spring.dependency-management" ) version " 1.1.6"
10- id(" com.github.ben-manes.versions" ) version " 0.51.0"
6+ jacoco
7+ checkstyle
8+ alias(libs.plugins.lombok)
9+ alias(libs.plugins.versions)
10+ alias(libs.plugins.spotless)
11+ alias(libs.plugins.spring.boot)
12+ alias(libs.plugins.spring.dependency.management)
13+ alias(libs.plugins.shadow)
14+ alias(libs.plugins.sonarqube)
1115}
1216
1317group = " io.hexlet.blog"
1418version = " 1.0-SNAPSHOT"
1519
16- application { mainClass.set(" io.hexlet.blog.Application" ) }
20+ application {
21+ mainClass.set(" io.hexlet.blog.Application" )
22+ }
1723
18- repositories { mavenCentral() }
24+ repositories {
25+ mavenCentral()
26+ }
1927
2028dependencies {
21- implementation(" org.springframework.boot:spring-boot-starter-web" )
22- implementation(" org.springframework.boot:spring-boot-starter-data-jpa" )
23- implementation(" org.springframework.boot:spring-boot-starter-validation" )
24- implementation(" org.springframework.boot:spring-boot-devtools" )
25- implementation(" org.springframework.boot:spring-boot-starter-actuator" )
26- implementation(" org.springframework.boot:spring-boot-configuration-processor" )
27- implementation(" org.springframework.boot:spring-boot-starter-security" )
28- implementation(" org.springframework.boot:spring-boot-starter-oauth2-resource-server" )
29+ // Spring Boot
30+ implementation(libs.springBootStarterWeb)
31+ implementation(libs.springBootStarterDataJpa)
32+ implementation(libs.springBootStarterValidation)
33+ implementation(libs.springBootStarterActuator)
34+ implementation(libs.springBootStarterSecurity)
35+ implementation(libs.springBootStarterOauth2ResourceServer)
36+ implementation(libs.springBootDevtools)
37+ implementation(libs.springBootConfigProcessor)
2938
30- implementation(" org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0" )
39+ // OpenAPI
40+ implementation(libs.springdocOpenapiUi)
3141
32- implementation(" org.openapitools:jackson-databind-nullable:0.2.6" )
33- implementation(" org.mapstruct:mapstruct:1.6.3" )
34- annotationProcessor(" org.mapstruct:mapstruct-processor:1.6.3" )
42+ // Utilities
43+ implementation(libs.jacksonDatabindNullable)
44+ implementation(libs.commonsLang3)
45+ implementation(libs.datafaker)
46+ implementation(libs.instancioJunit)
47+ implementation(libs.jsonunitAssertj)
3548
36- // implementation("io.github.wimdeblauwe:error-handling-spring-boot-starter:4.2.0")
49+ // MapStruct
50+ implementation(libs.mapstruct)
51+ annotationProcessor(libs.mapstructProcessor)
3752
38- implementation(" org.instancio:instancio-junit:5.0.2" )
39- implementation(" net.javacrumbs.json-unit:json-unit-assertj:4.0.0" )
40- implementation(" net.datafaker:datafaker:2.4.2" )
53+ // DB
54+ runtimeOnly(libs.h2)
4155
42- runtimeOnly(" com.h2database:h2:2.3.232" )
43- testImplementation(" org.springframework.security:spring-security-test" )
44- testImplementation(" org.springframework.boot:spring-boot-starter-test" )
45- testImplementation(platform(" org.junit:junit-bom:5.11.3" ))
46- testImplementation(" org.junit.jupiter:junit-jupiter:5.11.3" )
56+ // Tests
57+ testImplementation(libs.springBootStarterTest)
58+ testImplementation(libs.springSecurityTest)
59+ testImplementation(platform(libs.junitBom))
60+ testImplementation(libs.junitJupiter)
61+ testRuntimeOnly(libs.junitPlatformLauncher)
4762}
4863
49- // spotless {
50- // java {
51- // // Use the default importOrder configuration
52- // importOrder()
53- // }
54- // }
55-
5664tasks.test {
5765 useJUnitPlatform()
58- // https://technology.lastminute.com/junit5-kotlin-and-gradle-dsl/
5966 testLogging {
6067 exceptionFormat = TestExceptionFormat .FULL
61- events = mutableSetOf (TestLogEvent .FAILED , TestLogEvent .PASSED , TestLogEvent .SKIPPED )
62- // showStackTraces = true
63- // showCauses = true
68+ events = setOf (
69+ TestLogEvent .FAILED ,
70+ TestLogEvent .PASSED ,
71+ TestLogEvent .SKIPPED
72+ )
6473 showStandardStreams = true
6574 }
6675}
76+
77+ tasks.jacocoTestReport {
78+ reports {
79+ xml.required.set(true )
80+ }
81+ }
82+
83+ spotless {
84+ java {
85+ importOrder()
86+ removeUnusedImports()
87+ eclipse().sortMembersEnabled(true )
88+ formatAnnotations()
89+ indentWithSpaces(4 )
90+ }
91+ }
92+
93+ sonar {
94+ properties {
95+ property(" sonar.projectKey" , " hexlet-boilerplates_java-package" )
96+ property(" sonar.organization" , " hexlet-boilerplates" )
97+ property(" sonar.host.url" , " https://sonarcloud.io" )
98+ }
99+ }
100+
0 commit comments