简体   繁体   English

Java jar版本

[英]Java jar version

How to create the jar with version number in gradle. 如何在gradle中使用版本号创建jar。 I have the build script in gradle which creating the jar. 我在gradle中有用于创建jar的构建脚本。 I need to generate the jar with version number. 我需要用版本号生成jar。 How to achieve it using gradle script 如何使用gradle脚本实现

Thanks in advance 提前致谢

You can use add the below script 您可以使用添加以下脚本

jar {
    version='1.0'
}

So that it will generate the jar with version 这样它将生成带有版本的jar

Gradle will build your archive with the following pattern by default: Gradle默认情况下将使用以下模式构建档案:

[baseName]-[appendix]-[version]-[classifier].[extension]

if archiveName has not been explicitly set. 如果未明确设置archiveName

version - The version part of the archive name, if any. version -存档名称的版本部分(如果有)。

Applying: 应用:

jar {
    baseName = 'app'
    version='1.0'
}

Will specify the base name and the version to your archive: 将为您的存档指定基本名称和版本:

app-1.0.jar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM