듀플8

발행: (2026년 2월 6일 오전 05:06 GMT+9)
1 분 소요
원문: Dev.to

Source: Dev.to

JAR에서 MessageTypeConstant를 제거하는 Gradle 스크립트

// 1. Define where the "clean" JAR will live
def strippedLibDir = file("$buildDir/stripped-libs")

// 2. Task to perform the "surgery" on the JAR
task stripMessageTypeConstant(type: Copy) {
    doFirst {
        // Create a detached configuration to avoid locking the main build
        def detached = configurations.detachedConfiguration(
            dependencies.create("com.citigroup:EQRioINtf:1.3_D5")
        )
        def oldJarFile = detached.resolve().find { it.name.contains("EQRioINtf") }

        if (oldJarFile) {
            from zipTree(oldJarFile)
            into strippedLibDir
            // EXCLUDE: Physically remove the conflicting constant class
            exclude "com/citigroup/get/zcc/intf/MessageTypeConstant.class"
        }
    }
}

// 3. Update dependencies to use the result
dependencies {
    // Force OESIntf to be the source of truth for the constants
    implementation 'com.citigroup:OESIntf3_8:3.8_A29-SNAPSHOT'

    // Use the stripped directory as a dependency
    // This provides all other classes from EQRioINtf except the constant
    implementation files(strippedLibDir) {
        builtBy stripMessageTypeConstant
    }
}
0 조회
Back to Blog

관련 글

더 보기 »

Java 모듈

markdown !표지 이미지https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazo...