buildscript { repositories { mavenCentral() } } plugins { id 'java' id 'org.sonarqube' version '6.0.1.5171' id 'org.springframework.boot' version '3.5.6' id 'io.spring.dependency-management' version '1.1.7' id 'com.bmuschko.docker-remote-api' version '7.4.0' id 'maven-publish' id 'project-report' id 'build-dashboard' id 'com.github.jk1.dependency-license-report' version '2.9' id 'org.openjfx.javafxplugin' version '0.0.13' } sonarqube { properties { property "sonar.projectKey", "Java-Service-Tree-Framework-AI" property "sonar.host.url", "http://www.313.co.kr/sonar" property "sonar.login", "admin" property "sonar.password", "qwe123" } } java { toolchain { languageVersion = JavaLanguageVersion.of(21) // Java 21로 설정 } } javadoc { destinationDir = file("${buildDir}/docs/javadoc") } tasks.withType(Javadoc) { options.addStringOption('Xdoclint:none', '-quiet') failOnError = false } import com.github.jk1.license.render.* licenseReport { outputDir = "$projectDir/build/licenses" projects = [project] + project.subprojects configurations = ['runtimeClasspath'] excludeGroups = ['do.not.want'] excludes = ['moduleGroup:moduleName'] excludeOwnGroup = true excludeBoms = false renderers = [new InventoryHtmlReportRenderer("index.html", "Backend")] allowedLicensesFile = new File("$projectDir/allowed-licenses.json") } import org.apache.tools.ant.taskdefs.condition.Os ext { image = "313devgrp/java-service-tree-framework-ai" repositoryUrl = "http://www.313.co.kr/nexus/repository/ple-releases/" metadataUrl = "${repositoryUrl}313devgrp/Java-Service-Tree-Framework-AI/maven-metadata.xml" majorVersion = 26 minorVersion = 4 if (Os.isFamily(Os.FAMILY_WINDOWS)) { println "*** Windows " }else if (Os.isFamily(Os.FAMILY_MAC)) { println "*** Mac " }else { exec { executable "wget" args "-O", "${projectDir}/metadata.xml", "${metadataUrl}" } } def metadataFile = new XmlSlurper().parse(new File("${projectDir}/metadata.xml")) String latest = metadataFile."versioning"."latest" String versionPrefix = latest.split("-")[0] def (latestMajorVersion, latestMinorVersion, latestPatchVersion) = versionPrefix.tokenize(".") if ( majorVersion > latestMajorVersion.toInteger()){ minorVersion = 0 patchVersion = 0 } else if (minorVersion > latestMinorVersion.toInteger()){ patchVersion = 0 } else { patchVersion = latestPatchVersion.toInteger() + 1 } } task printVersion(){ doLast { println bootJar.version } } group = "313devgrp" version = "${majorVersion}.${minorVersion}.${patchVersion}" bootJar { version = project.version } task generatePublishInfo { def targetFile = new File("${projectDir}/spinnaker.properties") targetFile.parentFile.mkdirs() targetFile.withWriter("UTF-8") { w -> w.writeLine "groupId = " + project.group w.writeLine "artifactId = " + project.name w.writeLine "version = " + project.version } } publish { dependsOn generatePublishInfo } def getMavenSettingsCredentials = { String userHome = System.getProperty("user.home") File mavenSettings = new File ( userHome, ".m2/settings.xml") if (Os.isFamily(Os.FAMILY_WINDOWS)||Os.isFamily(Os.FAMILY_MAC)) { if(!mavenSettings.exists()){ mavenSettings = new File("${projectDir}/settings.xml") } }else { if(!mavenSettings.exists()){ mavenSettings = new File ("${projectDir}/settings.xml") } } def xmlSlurper = new XmlSlurper() def output = xmlSlurper.parse(mavenSettings) return output."servers"."server" } def getCredentials = { def entries = getMavenSettingsCredentials() for ( entry in entries ) { if (project.version.endsWith("-SNAPSHOT") && entry."id".text() == "snapshots"){ return [username: entry.username.text(), password: entry.password.text()] }else { return [username: entry.username.text(), password: entry.password.text()] } } } publishing { def mvnCredential = getCredentials() repositories { maven { credentials{ username mvnCredential["username"] password mvnCredential["password"] } url "${repositoryUrl}" allowInsecureProtocol true } } publications { maven(MavenPublication) { groupId = project.group artifactId = project.name version = project.version artifact bootJar } } } configurations { compileOnly { extendsFrom annotationProcessor } } repositories { mavenCentral() maven { url 'http://www.313.co.kr/nexus/repository/ple-releases' allowInsecureProtocol true } } dependencyManagement { imports { mavenBom "org.springframework.cloud:spring-cloud-dependencies:2025.0.1" mavenBom "org.springframework.ai:spring-ai-bom:1.0.0-M8" } } tasks.named('test') { useJUnitPlatform() } dependencies { // Lombok compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' // Test testImplementation('org.springframework.boot:spring-boot-starter-test') { exclude module: 'junit' } testRuntimeOnly 'org.junit.platform:junit-platform-launcher' // Spring Boot implementation 'org.springframework.boot:spring-boot-starter-webflux' implementation 'org.springframework.boot:spring-boot-starter-actuator' // Spring Cloud implementation 'org.springframework.cloud:spring-cloud-starter-config' implementation 'org.springframework.cloud:spring-cloud-starter-openfeign' // Spring AI 1.0.0 (BOM 관리) implementation 'org.springframework.ai:spring-ai-starter-model-ollama' // Spring AI - Document Readers (PDFBox 3.x 사용) implementation 'org.springframework.ai:spring-ai-pdf-document-reader' implementation 'org.springframework.ai:spring-ai-markdown-document-reader' // Spring AI - Vector Store implementation 'org.springframework.ai:spring-ai-starter-vector-store-opensearch' // Spring AI - RAG implementation 'org.springframework.ai:spring-ai-rag' // ONNX 런타임 implementation 'com.microsoft.onnxruntime:onnxruntime:1.18.0' // PDF 이미지 렌더링 (spring-ai-pdf-document-reader와 호환되는 PDFBox 3.x) implementation 'org.apache.pdfbox:pdfbox:3.0.3' // Apache POI — Word(docx) / PPT(pptx) / Excel(xlsx) 파일 생성 implementation 'org.apache.poi:poi:5.3.0' implementation 'org.apache.poi:poi-ooxml:5.3.0' // Validation implementation 'org.hibernate.validator:hibernate-validator:8.0.1.Final' implementation 'org.glassfish:jakarta.el:4.0.2' // Micrometer Tracing + Zipkin (Spring Boot 3.x) implementation 'io.micrometer:micrometer-tracing-bridge-brave' implementation 'io.zipkin.reporter2:zipkin-reporter-brave' // Slack implementation 'com.slack.api:slack-api-client:1.25.1' // Swagger implementation 'org.springdoc:springdoc-openapi-starter-webflux-ui:2.1.0' // Jackson implementation 'com.fasterxml.jackson.core:jackson-databind' implementation 'com.fasterxml.jackson.core:jackson-annotations' implementation 'com.fasterxml.jackson.datatype:jackson-datatype-joda' } import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage import com.bmuschko.gradle.docker.tasks.image.DockerPushImage def jarFile = tasks.bootJar.outputs.files.singleFile def imageName = "313.co.kr:5550/${project.findProperty('image') ?: 'default-image'}:${project.version}" println "🔧 Docker Image: ${imageName}" task prepareDockerContext(type: Copy) { dependsOn bootJar from jarFile from 'docker-entrypoint.sh' from "$projectDir/Dockerfile" into "$buildDir/docker" } task buildDockerImage(type: DockerBuildImage) { dependsOn prepareDockerContext inputDir = file("$buildDir/docker") dockerFile = file("$buildDir/docker/Dockerfile") images = [imageName] noCache = true buildArgs = [ 'JAR_FILE' : jarFile.name, 'ENTRY_FILE': 'docker-entrypoint.sh' ] } task pushDockerImage(type: DockerPushImage) { dependsOn buildDockerImage images = [imageName] }