2024-09-12 22:54:02 +00:00
|
|
|
import com.github.spotbugs.snom.Confidence
|
|
|
|
import com.github.spotbugs.snom.Effort
|
|
|
|
import com.github.spotbugs.snom.SpotBugsTask
|
2024-09-12 22:01:00 +00:00
|
|
|
import org.hidetake.gradle.swagger.generator.GenerateSwaggerCode
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
}
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
java
|
2024-09-12 22:23:47 +00:00
|
|
|
checkstyle
|
2024-09-27 10:15:35 +00:00
|
|
|
id("com.github.spotbugs") version "6.0.23"
|
2024-09-12 22:01:00 +00:00
|
|
|
id("org.springframework.boot") version "3.3.3"
|
|
|
|
id("io.spring.dependency-management") version "1.1.6"
|
|
|
|
id("org.hidetake.swagger.generator") version "2.19.2"
|
|
|
|
}
|
|
|
|
|
2024-09-12 22:23:47 +00:00
|
|
|
checkstyle {
|
|
|
|
toolVersion = "10.12.4"
|
2024-09-19 19:53:57 +00:00
|
|
|
configDirectory = file("src/main/resources/")
|
2024-09-12 22:23:47 +00:00
|
|
|
configFile = file("src/main/resources/checkstyle.xml")
|
|
|
|
}
|
|
|
|
|
2024-09-12 22:54:02 +00:00
|
|
|
spotbugs {
|
2024-09-30 07:07:08 +00:00
|
|
|
toolVersion = "4.8.6"
|
2024-09-12 22:54:02 +00:00
|
|
|
effort.set(Effort.MAX)
|
|
|
|
reportLevel.set(Confidence.LOW)
|
|
|
|
}
|
|
|
|
|
2024-09-12 22:01:00 +00:00
|
|
|
group = "de.hmmh"
|
|
|
|
version = "0.0.1-SNAPSHOT"
|
|
|
|
|
|
|
|
java {
|
|
|
|
toolchain {
|
2024-09-12 22:30:08 +00:00
|
|
|
languageVersion = JavaLanguageVersion.of(21)
|
2024-09-12 22:01:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
configurations {
|
|
|
|
compileOnly {
|
|
|
|
extendsFrom(configurations.annotationProcessor.get())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2024-09-27 10:15:35 +00:00
|
|
|
// Spring
|
2024-09-12 22:01:00 +00:00
|
|
|
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
|
|
|
|
implementation("org.springframework.boot:spring-boot-starter-validation")
|
|
|
|
implementation("org.springframework.boot:spring-boot-starter-web")
|
2024-09-27 10:16:41 +00:00
|
|
|
implementation("org.springframework.boot:spring-boot-starter-security")
|
|
|
|
implementation("org.springframework.boot:spring-boot-starter-oauth2-client")
|
|
|
|
implementation("org.springframework.boot:spring-boot-starter-oauth2-resource-server")
|
|
|
|
|
|
|
|
// Postgres
|
2024-09-12 22:01:00 +00:00
|
|
|
runtimeOnly("org.postgresql:postgresql")
|
2024-09-12 22:54:02 +00:00
|
|
|
|
2024-09-27 10:15:35 +00:00
|
|
|
// Lombok
|
2024-09-12 22:01:00 +00:00
|
|
|
compileOnly("org.projectlombok:lombok")
|
|
|
|
annotationProcessor("org.projectlombok:lombok")
|
2024-09-12 22:54:02 +00:00
|
|
|
|
2024-09-27 10:15:35 +00:00
|
|
|
// Test
|
2024-09-12 22:01:00 +00:00
|
|
|
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
|
|
|
testImplementation("org.springframework.boot:spring-boot-testcontainers")
|
2024-09-27 10:16:41 +00:00
|
|
|
testImplementation("org.springframework.security:spring-security-test")
|
2024-09-12 22:01:00 +00:00
|
|
|
testImplementation("org.testcontainers:junit-jupiter")
|
|
|
|
testImplementation("org.testcontainers:postgresql")
|
2024-10-01 18:46:31 +00:00
|
|
|
testRuntimeOnly("com.h2database:h2")
|
2024-09-12 22:01:00 +00:00
|
|
|
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
|
|
|
|
|
|
|
//OAS
|
2024-09-19 19:06:56 +00:00
|
|
|
swaggerCodegen("io.swagger.codegen.v3:swagger-codegen-cli:3.0.61")
|
2024-09-12 22:01:00 +00:00
|
|
|
implementation("io.swagger.core.v3:swagger-annotations:2.2.22")
|
2024-09-27 10:15:35 +00:00
|
|
|
implementation("jakarta.xml.bind:jakarta.xml.bind-api") //Needed for XML/HTML Validation
|
2024-09-12 22:01:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
swaggerSources {
|
|
|
|
register("pmt") {
|
2024-09-30 07:07:08 +00:00
|
|
|
setInputFile(file("${rootDir}/api/pmt.yml"))
|
|
|
|
code.configFile = file("${rootDir}/gen/config-pmt.json")
|
2024-09-12 22:01:00 +00:00
|
|
|
val validationTask = validation
|
|
|
|
code(delegateClosureOf<GenerateSwaggerCode> {
|
|
|
|
language = "spring"
|
2024-09-12 22:54:02 +00:00
|
|
|
code.rawOptions =
|
2024-09-30 07:07:08 +00:00
|
|
|
listOf("--ignore-file-override=" + file("${rootDir}/gen/.ignore-pmt").absolutePath)
|
2024-09-12 22:01:00 +00:00
|
|
|
dependsOn(validationTask)
|
|
|
|
})
|
|
|
|
}
|
2024-09-30 07:07:08 +00:00
|
|
|
create("employee") {
|
|
|
|
setInputFile(file("${rootDir}/api/employee.yml"))
|
|
|
|
code.configFile = file("${rootDir}/gen/config-employee.json")
|
|
|
|
code(delegateClosureOf<GenerateSwaggerCode> {
|
|
|
|
language = "java"
|
|
|
|
})
|
|
|
|
}
|
2024-09-12 22:01:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tasks {
|
2024-09-12 22:54:02 +00:00
|
|
|
withType<Checkstyle> {
|
|
|
|
reports {
|
|
|
|
xml.required.set(true)
|
|
|
|
html.required.set(false)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
withType<SpotBugsTask> {
|
|
|
|
excludeFilter.set(file("${rootDir}/src/main/resources/spotbugs-exclude.xml"))
|
|
|
|
}
|
2024-09-12 22:01:00 +00:00
|
|
|
processResources {
|
|
|
|
dependsOn(generateSwaggerCode)
|
|
|
|
}
|
|
|
|
withType<Test> {
|
|
|
|
useJUnitPlatform()
|
|
|
|
}
|
|
|
|
named("compileJava").configure {
|
|
|
|
dependsOn(swaggerSources.getByName("pmt").code)
|
2024-09-30 07:07:08 +00:00
|
|
|
dependsOn(swaggerSources.getByName("employee").code)
|
2024-09-12 22:01:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sourceSets {
|
|
|
|
main {
|
|
|
|
java.srcDir("${swaggerSources.getByName("pmt").code.outputDir}/src/main/java")
|
|
|
|
resources.srcDir("${swaggerSources.getByName("pmt").code.outputDir}/src/main/resources")
|
2024-09-30 07:07:08 +00:00
|
|
|
|
|
|
|
java.srcDir("${swaggerSources.getByName("employee").code.outputDir}/src/main/java")
|
|
|
|
resources.srcDir("${swaggerSources.getByName("employee").code.outputDir}/src/main/resources")
|
2024-09-12 22:01:00 +00:00
|
|
|
}
|
|
|
|
}
|