chore: align scaffold gradle with tool standard
All checks were successful
Deploy to OCIWP / deploy (push) Successful in 1m38s

This commit is contained in:
jade
2026-08-07 16:56:07 +09:00
parent 782dee0d19
commit 7c9077dbd1
7 changed files with 120 additions and 59 deletions

View File

@@ -1,60 +1,88 @@
// 루트 Gradle 설정: 모든 Gateway/Tool Pod 모듈이 공유하는 빌드 기준을 정의합니다.
plugins {
// Java 컴파일, 테스트, JAR 생성 기능을 제공합니다.
id 'java'
// 하위 실행 모듈에서 bootRun/bootJar를 사용하기 위한 Spring Boot 플러그인입니다.
// 루트 프로젝트에는 적용하지 않으므로 apply false를 사용합니다.
id 'org.springframework.boot' version '3.5.11' apply false
// Spring Boot / Spring AI BOM에 정의된 라이브러리 버전을 일관되게 적용합니다.
id 'io.spring.dependency-management' version '1.1.6' apply false
}
// 모든 모듈이 공유하는 Maven 식별자입니다.
allprojects {
group = 'io.shinhanlife'
version = '0.0.1-SNAPSHOT'
}
// dap-gateway, dap-was-lib, dap-was-oth, dap-was-sms에 공통 적용합니다.
subprojects {
apply plugin: 'java'
apply plugin: 'io.spring.dependency-management'
java {
// 프로젝트 표준 Java 버전입니다.
sourceCompatibility = '21'
}
repositories {
// 현재 공개 정식 라이브러리 저장소입니다.
// 폐쇄망 적용 시 사내 Nexus Proxy URL로 교체합니다.
mavenCentral()
maven { url 'https://repo.spring.io/milestone' }
maven { url 'https://repo.spring.io/snapshot' }
}
dependencyManagement {
imports {
// Spring Boot 3.5.11과 호환되는 Spring/Jackson/Tomcat 등의 버전을 관리합니다.
mavenBom org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES
mavenBom "org.springframework.ai:spring-ai-bom:1.1.8"
// Spring AI, MCP, OpenAI 연동 라이브러리의 호환 버전을 1.1.8로 고정합니다.
mavenBom 'org.springframework.ai:spring-ai-bom:1.1.8'
}
}
dependencies {
// Lombok은 컴파일 시 getter/builder 등 반복 코드를 생성하며 실행 JAR에는 포함하지 않습니다.
compileOnly 'org.projectlombok:lombok:1.18.32'
annotationProcessor 'org.projectlombok:lombok:1.18.32'
annotationProcessor 'org.projectlombok:lombok-mapstruct-binding:0.2.0'
testCompileOnly 'org.projectlombok:lombok:1.18.32'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.32'
// Tool DTO와 MCI 요청/응답 객체 간 Converter 구현체를 컴파일 시 자동 생성합니다.
implementation 'org.mapstruct:mapstruct:1.5.5.Final'
annotationProcessor 'org.projectlombok:lombok-mapstruct-binding:0.2.0'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.5.Final'
// 모든 모듈의 JUnit 5 기반 테스트 공통 의존성입니다.
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
tasks.withType(JavaCompile) {
// 리플렉션/MCP Schema 생성 시 메서드 파라미터명을 사용할 수 있도록 보존합니다.
options.compilerArgs << '-parameters'
// MapStruct 구현체를 Spring Bean으로 생성해 생성자 주입으로 사용할 수 있게 합니다.
options.compilerArgs << '-Amapstruct.defaultComponentModel=spring'
}
tasks.withType(Test) {
// JUnit 5 테스트 플랫폼을 사용합니다.
useJUnitPlatform()
}
}
// Tool 이름 중복 검사 프로그램이 포함된 공통 라이브러리 모듈입니다.
def toolCoreProject = project(':dap-was-lib')
// 전체 Tool Pod의 @McpTool(name) 중복을 배포 산출물 생성 전에 차단합니다.
tasks.register('validateMcpToolNames', JavaExec) {
group = 'verification'
description = 'Checks duplicate @McpFunction names across all Tool modules before packaging.'
description = 'Checks duplicate @McpTool names across all Tool modules before packaging.'
// 검사 Runner를 실행하기 전에 dap-was-lib 클래스를 먼저 컴파일합니다.
dependsOn toolCoreProject.tasks.named('classes')
classpath = toolCoreProject.sourceSets.main.runtimeClasspath
mainClass.set('io.shinhanlife.dap.lib.validation.McpToolNameValidationRunner')
@@ -62,7 +90,8 @@ tasks.register('validateMcpToolNames', JavaExec) {
}
subprojects {
// 배포용 Spring Boot JAR 생성 전에 Tool 이름 중복 검증을 강제합니다.
tasks.matching { it.name == 'bootJar' }.configureEach {
dependsOn rootProject.tasks.named('validateMcpToolNames')
}
}
}

View File

@@ -1,39 +1,34 @@
plugins {
// Gateway를 독립 실행 가능한 Spring Boot JAR로 생성합니다.
id 'org.springframework.boot'
}
dependencies {
// Tool Registry, MCP 공통 처리, 보안/Schema 유틸리티를 공통 라이브러리에서 가져옵니다.
implementation project(':dap-was-lib')
// Gateway REST API와 관리 화면의 HTTP 요청을 처리합니다.
implementation 'org.springframework.boot:spring-boot-starter-web'
// Tool Registry 및 분산 캐시 연동에 사용합니다.
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
// Spring AI MCP Server
implementation 'org.springframework.ai:spring-ai-starter-mcp-server-webmvc'
implementation 'org.springframework.ai:spring-ai-starter-model-openai'
implementation 'org.springframework.ai:spring-ai-openai'
// MyBatis & DB
// Tool/Registry 관련 DB 조회와 MyBatis Mapper 실행에 사용합니다.
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:3.0.3'
// Gateway가 /mcp Endpoint를 MCP Server로 노출하도록 지원합니다.
implementation 'org.springframework.ai:spring-ai-starter-mcp-server-webmvc'
// ChatClient를 통해 OpenAI/OpenRouter 호환 모델을 호출합니다.
implementation 'org.springframework.ai:spring-ai-starter-model-openai'
// 로컬 개발·테스트용 인메모리 DB입니다. 운영 DB에는 사용하지 않습니다.
runtimeOnly 'com.h2database:h2'
// SQL 로그를 확인하기 위한 JDBC 프록시입니다.
implementation 'p6spy:p6spy:3.9.1'
// MapStruct
implementation "org.mapstruct:mapstruct:1.5.5.Final"
annotationProcessor "org.projectlombok:lombok-mapstruct-binding:0.2.0"
annotationProcessor "org.mapstruct:mapstruct-processor:1.5.5.Final"
// implementation 'com.networknt:json-schema-validator:1.4.0' // Spring AI 내장 버전과 충돌 방지를 위해 주석 처리
// Gateway REST API 문서와 Swagger UI를 제공합니다.
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.5.0'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
tasks.named('test') {
useJUnitPlatform()
}
dependencies {
compileOnly 'org.projectlombok:lombok:1.18.32'
annotationProcessor 'org.projectlombok:lombok:1.18.32'
}

View File

@@ -1,41 +1,55 @@
plugins {
// Gateway와 모든 Tool Pod가 의존하는 공통 라이브러리 모듈입니다.
id 'java-library'
}
dependencies {
// 공통 REST Controller, HTTP Client, 예외 처리 기반입니다.
api 'org.springframework.boot:spring-boot-starter-web'
// Tool Request DTO의 Bean Validation을 지원합니다.
api 'org.springframework.boot:spring-boot-starter-validation'
// Tool Manifest/Registry 캐시 및 Redis 기반 공통 기능을 제공합니다.
api 'org.springframework.boot:spring-boot-starter-data-redis'
// Tool SLA, 로깅, 공통 Aspect를 적용합니다.
api 'org.springframework.boot:spring-boot-starter-aop'
// MCI/DB 연동에 필요한 JDBC 공통 기능입니다.
api 'org.springframework.boot:spring-boot-starter-jdbc'
// Tool 호출의 Circuit Breaker, Rate Limit, Retry 등 복원력 기능입니다.
api 'io.github.resilience4j:resilience4j-spring-boot3:2.2.0'
api 'io.github.resilience4j:resilience4j-core:2.2.0'
api 'io.github.resilience4j:resilience4j-circuitbreaker:2.2.0'
api 'io.github.resilience4j:resilience4j-ratelimiter'
api 'io.github.resilience4j:resilience4j-retry:2.2.0'
api 'org.springframework.boot:spring-boot-starter-aop'
api 'org.springframework.boot:spring-boot-starter-jdbc'
// MCI/업무 데이터 접근을 위한 MyBatis 지원입니다.
api 'org.mybatis.spring.boot:mybatis-spring-boot-starter:3.0.3'
// 현재 로컬 테스트 DB 및 SQL 로그 처리에 사용합니다.
api 'com.h2database:h2'
api 'p6spy:p6spy:3.9.1'
// Spring Data Redis가 사용하는 Redis Client를 공통 모듈에서 직접 참조합니다.
api 'io.lettuce:lettuce-core:6.6.0.RELEASE'
api "org.mapstruct:mapstruct:1.5.5.Final"
// MCI XML 전문, JSON Tool Schema/Manifest 처리에 사용합니다.
api 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.17.1'
api 'com.fasterxml.jackson.core:jackson-databind:2.17.1'
api 'com.networknt:json-schema-validator:3.0.0'
// Tool Pod의 /mcp Streamable HTTP Server와 MCP SDK를 제공합니다.
api 'org.springframework.ai:spring-ai-starter-mcp-server-webmvc'
// Spring AI 1.1.x에서 @McpTool, @McpToolParam, metaProvider를 제공합니다.
api 'org.springaicommunity:mcp-annotations:0.9.0'
// 이벤트 기반 확장이 필요한 Tool의 공통 Kafka 연동 기능입니다.
api 'org.springframework.kafka:spring-kafka:3.2.0'
// Tool Pod REST API 문서 및 Swagger UI를 제공합니다.
api 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.5.0'
}
dependencies {
compileOnly 'org.projectlombok:lombok:1.18.32'
annotationProcessor 'org.projectlombok:lombok:1.18.32'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testCompileOnly 'org.projectlombok:lombok:1.18.32'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.32'
}

View File

@@ -46,7 +46,11 @@ public class PodScaffolder {
public static String scaffoldPod(String moduleName, String portStr, String shortName, String author, String createDate) throws IOException {
String envSourceDir = System.getenv("AXHUB_SOURCE_DIR");
Path rootDir = envSourceDir != null ? Paths.get(envSourceDir) : Paths.get(".");
return scaffoldPod(rootDir, moduleName, portStr, shortName, author, createDate);
}
static String scaffoldPod(Path rootDir, String moduleName, String portStr, String shortName,
String author, String createDate) throws IOException {
Path modulePath = rootDir.resolve(Paths.get(moduleName));
if (Files.exists(modulePath)) {
return "[오류] 이미 존재하는 모듈입니다: " + moduleName;
@@ -59,15 +63,14 @@ public class PodScaffolder {
log.append("[2/6] build.gradle 생성 중...\n");
String buildGradle = """
plugins {
// Spring Boot 3.5.11 version is managed by the root build.gradle.
id 'org.springframework.boot'
}
dependencies {
// Shared MCP, Glow integration, validation, logging, Lombok and MapStruct configuration.
implementation project(':dap-was-lib')
}
dependencies {
compileOnly 'org.projectlombok:lombok:1.18.32'
annotationProcessor 'org.projectlombok:lombok:1.18.32'
}
""";
Files.writeString(modulePath.resolve("build.gradle"), buildGradle);

View File

@@ -0,0 +1,26 @@
package io.shinhanlife.dap.lib.util;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.nio.file.Files;
import java.nio.file.Path;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
class PodScaffolderTest {
@TempDir
Path root;
@Test
void generatesBuildGradleUsingRepositoryStandard() throws Exception {
PodScaffolder.scaffoldPod(root, "dap-was-sample", "8099", "sample", "tester", "2026.08.07");
String buildGradle = Files.readString(root.resolve("dap-was-sample/build.gradle"));
assertTrue(buildGradle.contains("id 'org.springframework.boot'"));
assertTrue(buildGradle.contains("Spring Boot 3.5.11"));
assertTrue(buildGradle.contains("implementation project(':dap-was-lib')"));
assertFalse(buildGradle.contains("compileOnly 'org.projectlombok:lombok"));
}
}

View File

@@ -1,12 +1,9 @@
plugins {
// OTH Tool Pod를 독립 실행 가능한 Spring Boot JAR로 생성합니다.
id 'org.springframework.boot'
}
dependencies {
// MCP Server, Tool 공통 처리, MCI/EAI 연동 기반은 dap-was-lib에서 상속합니다.
implementation project(':dap-was-lib')
}
dependencies {
compileOnly 'org.projectlombok:lombok:1.18.32'
annotationProcessor 'org.projectlombok:lombok:1.18.32'
}

View File

@@ -1,12 +1,9 @@
plugins {
// SMS Tool Pod를 독립 실행 가능한 Spring Boot JAR로 생성합니다.
id 'org.springframework.boot'
}
dependencies {
// MCP Server, Tool 공통 처리, MCI/EAI 연동 기반은 dap-was-lib에서 상속합니다.
implementation project(':dap-was-lib')
}
dependencies {
compileOnly 'org.projectlombok:lombok:1.18.32'
annotationProcessor 'org.projectlombok:lombok:1.18.32'
}