목표
- 하나의 Gradle 프로젝트 내에서 특정 패키지(cc, dd)만 별도 JAR로 생성
- 생성된 JAR을 libs 디렉토리에 넣고 implementation fileTree(...) 방식으로 참조
- 원본 소스(src/main/cofor/wts/cc dd)는 삭제
build.gradle 추가
task customJar1(type: Jar) {
archiveBaseName.set("Dataconverter")
destinationDirectory.set(file("$buildDir/custom-libs"))
from sourceSets.main.output.classesDirs
include '**/aa/bb/cc/**'
from sourceSets.main.output.resourcesDir
}
task customJar2(type: Jar) {
archiveBaseName.set("RelaySocket")
destinationDirectory.set(file("$buildDir/custom-libs"))
from sourceSets.main.output.classesDirs
include '**/aa/bb/dd/**'
from sourceSets.main.output.resourcesDir
}
#./gradlew customJar
생성된 JAR을 libs/로 이동
cp build/custom-libs/Dataconverter.jar libs/
cp build/custom-libs/RelaySocket.jar libs/
소스 삭제
rm -rf src/main/java/cofor/wts/cc
rm -rf src/main/java/cofor/wts/dd
'프로그래밍 > Java' 카테고리의 다른 글
Java에서 c 소스 miniLZO 압축 라이브러리 Java JNI 연동하기 (1) | 2025.04.28 |
---|---|
전자서명 / 검증 / 부인방지 개념정리 (0) | 2025.02.19 |
spring boot 이용한 JWT 로그인 로그아웃 토큰 유효성 검사 (0) | 2025.01.21 |
spring boot gradle REST API 서버 테스트 구축 (1) | 2025.01.17 |
전문 mymq 릴레이소켓 연결시 이슈 (0) | 2024.12.27 |