Gradle - jar file name in java plugin

前端 未结 9 1839
借酒劲吻你
借酒劲吻你 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:34

    if you want to append a date to the jar file name, you can do it like this:

    jar {
        baseName +='_' +new java.text.SimpleDateFormat("dd_MM_yyyy").format(new java.util.Date())
        println(baseName) // just to verify
    

    which results in _07_05_2020.jar

提交回复
热议问题