Gradle problems

已回答

I have Kotlin project using Gradle.  Taking a suggestion from the web, I have the following in build.gradle.kts

version = "1.2.3"

tasks.jar {
    exclude("META-INF/*.RSA")
    exclude("META-INF/*.SF")
    exclude("META-INF/*.DSA")

    manifest {
        attributes(
            "Main-Class" to "org.somethingOrOther.somethingOrOtherElse.MainKt",
            "Implementation-Version" to project.version
        )
    }
}

 

My aim is to exclude *.RSA, *.SF and *.DSA files from the JAR (which seem to give security problems; and also to find a way such that the version recorded in build.gradle.kts is also available (via some rather obscure code) in the Kotlin program.

Unfortunately, nothing I do seems to make this work – the RSA, SF and DSA files still turn up in the JAR, and I don't seem to be able to access the manifest data successfully.

0

Hello, Jamie!

Thank you for reporting this!

I've tested the code you've shared and it seems to work as intended. Note, however, that excludes are case-sensitive, so if the files have extensions like *.rsa, *.sf, *.dsa they won't be excluded.

Does the issue persist if you run Gradle from the OS Command Prompt?

0

请先登录再写评论。