Gradle - jar file name in java plugin

前端 未结 9 1834
借酒劲吻你
借酒劲吻你 2021-02-01 11:46

I am trying with Gradle first time. I am trying with a maven java project to compile and create a jar file. It is compiling and creating the jar file in build/libs directory as

9条回答
  •  后悔当初
    2021-02-01 12:29

    Currently using Kotlin as Gradle DSL. Following statement works for me:

    tasks.withType {
        setProperty("archiveFileName", "hello-world.jar")
    }
    

    It works on Spring Boot executable jars as well.

    If you want to keep version numbers:

    tasks.withType {
        setProperty("archiveBaseName", "hello-world")
    }
    

    It will produce something like hello-world-1.2.3.jar

提交回复
热议问题