You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
151 lines
4.9 KiB
Groovy
151 lines
4.9 KiB
Groovy
plugins {
|
|
id 'java'
|
|
id 'org.springframework.boot' version '3.5.0'
|
|
id 'io.spring.dependency-management' version '1.1.7'
|
|
}
|
|
|
|
group = 'org.demon'
|
|
version = '0.0.1-SNAPSHOT'
|
|
|
|
java {
|
|
toolchain {
|
|
languageVersion = JavaLanguageVersion.of(17)
|
|
}
|
|
}
|
|
|
|
configurations {
|
|
compileOnly {
|
|
extendsFrom annotationProcessor
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
/**
|
|
* ====== 빌드타임 스위칭 ======
|
|
* 사용법:
|
|
* - OLD 스키마(기본): ./gradlew clean build
|
|
* - NEW 스키마: ./gradlew clean build -PcpSchema=new
|
|
*
|
|
* 디렉터리 구조(패키지는 반드시 동일해야 함):
|
|
* - schemas/com/worker/domain/entity ← OLD 엔티티들 (package com.worker.domain.entity;)
|
|
* - schemas/com/worker/domain/entity_new ← NEW 엔티티들 (package com.worker.domain.entity;)
|
|
*/
|
|
//def schema = (project.findProperty("cpSchema") ?: "old") // 'old' | 'new'
|
|
//def isNew = schema == "new"
|
|
|
|
def schema = "new"
|
|
def isNew = true
|
|
|
|
springBoot {
|
|
mainClass = "com.worker.CleanParkingWorkerApplication" // 실제 패키지/클래스명으로!
|
|
}
|
|
sourceSets {
|
|
main {
|
|
java {
|
|
// 공통 코드
|
|
setSrcDirs(["src/main/java", "src/schemas"])
|
|
if (isNew) {
|
|
// old제외
|
|
exclude "com/worker/domain/entity/**"
|
|
exclude "com/worker/domain/repo/**"
|
|
} else {
|
|
// new제외
|
|
exclude "com/worker/domain/entity_new/**"
|
|
exclude "com/worker/domain/repo_new/**"
|
|
}
|
|
}
|
|
resources {
|
|
setSrcDirs(["src/main/resources"])
|
|
}
|
|
}
|
|
}
|
|
|
|
//apply plugin: 'idea'
|
|
//idea {
|
|
// module {
|
|
// // Gradle 컴파일은 이미 old만 포함이지만,
|
|
// // IDE가 엔티티 경로를 소스 루트로 잡지 않게 명시적으로 제외
|
|
// excludeDirs += file('src/schemas/com/worker/domain/entity_new')
|
|
// excludeDirs += file('src/schemas/com/worker/domain/repo_new')
|
|
//// excludeDirs += file('src/schemas/com/worker/domain/entity')
|
|
//// excludeDirs += file('src/schemas/com/worker/domain/repo')
|
|
//
|
|
// // (선택) 아예 IDE 소스루트를 old로만 제한하고 싶다면 아래처럼 지정도 가능
|
|
// // sourceDirs = [
|
|
// // file('src/main/java'),
|
|
// // file('src/schemas/com/worker/domain/entity'),
|
|
// // file('src/schemas/com/worker/domain/repo')
|
|
// // ] as Set
|
|
// }
|
|
//}
|
|
|
|
|
|
/**
|
|
* ====== 의존성 ======
|
|
* (중복/불필요 항목 정리)
|
|
*/
|
|
dependencies {
|
|
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
|
implementation 'org.springframework.boot:spring-boot-starter-quartz'
|
|
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
|
|
implementation 'org.springframework.boot:spring-boot-starter-web'
|
|
implementation 'org.springframework.boot:spring-boot-starter-webflux'
|
|
implementation 'org.springframework.session:spring-session-core'
|
|
|
|
compileOnly 'org.projectlombok:lombok'
|
|
annotationProcessor 'org.projectlombok:lombok'
|
|
|
|
developmentOnly 'org.springframework.boot:spring-boot-devtools'
|
|
|
|
// DB 드라이버 (필요한 것만 남기세요)
|
|
runtimeOnly 'com.mysql:mysql-connector-j'
|
|
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client'
|
|
runtimeOnly 'com.oracle.database.jdbc:ojdbc11'
|
|
|
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
|
|
|
// === QueryDSL (Spring Boot 3.x / Jakarta) ===
|
|
implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta'
|
|
annotationProcessor 'com.querydsl:querydsl-apt:5.0.0:jakarta'
|
|
annotationProcessor 'jakarta.annotation:jakarta.annotation-api'
|
|
annotationProcessor 'jakarta.persistence:jakarta.persistence-api'
|
|
|
|
// sftp
|
|
implementation 'com.jcraft:jsch:0.1.55'
|
|
}
|
|
|
|
tasks.named('test') {
|
|
useJUnitPlatform()
|
|
}
|
|
|
|
/**
|
|
* ====== QueryDSL 생성 경로 설정 및 포함 ======
|
|
* Q클래스는 여기에 생성됨:
|
|
* build/generated/sources/annotationProcessor/java/main
|
|
* 소스셋에 포함시켜 IDE/컴파일러가 인식하도록 추가.
|
|
*/
|
|
tasks.withType(JavaCompile).configureEach {
|
|
options.annotationProcessorGeneratedSourcesDirectory = file("$buildDir/generated/sources/annotationProcessor/java/main")
|
|
}
|
|
|
|
sourceSets.main.java.srcDir("$buildDir/generated/sources/annotationProcessor/java/main")
|
|
|
|
// clean 시 생성된 Q소스도 함께 정리
|
|
tasks.clean.doFirst {
|
|
delete("$buildDir/generated/sources/annotationProcessor/java/main")
|
|
}
|
|
// 어떤 자바 파일이 실제로 main 소스셋에 들어갔는지 출력
|
|
tasks.register("printJavaFiles") {
|
|
doLast {
|
|
println "cpSchema/new? isNew = ${isNew}"
|
|
println "Included Java files in main:"
|
|
def files = sourceSets.main.java.asFileTree.matching { include '**/*.java' }
|
|
.files.toList().sort { a, b -> a.path <=> b.path }
|
|
files.each { println " - ${it}" }
|
|
println "Total: ${files.size()}"
|
|
}
|
|
} |