Java插件中的Gradle - jar文件名 [英] Gradle - jar file name in java plugin
问题描述
$ b
trunk -XXXVERSION-SNAPSHOT.jar
我从这个maven java项目的trunk目录运行gradle构建文件。
我想在jar文件名中得到项目名称(例如:project1),就像
project1 -XXXVERSION-SNAPSHOT.jar
在build / libs目录。
请建议。
默认项目名称取自项目存储目录。明确指定jar的命名,应该为项目设置正确的项目名称。目前,这在 build.gradle
文件中是不可能的。相反,您必须在根目录中创建 settings.gradle
文件。这个 settings.gradle
文件应该包含以下内容:
rootProject .name ='project1'
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
trunk-XXXVERSION-SNAPSHOT.jar
I am running gradle build file from trunk directory of this maven java project.
I want to get the project name (for ex: project1) in the jar file name, something like
project1-XXXVERSION-SNAPSHOT.jar
in build/libs directory. Please suggest.
The default project name is taken from the directory the project is stored in. Instead of changing the naming of the jar explicitly you should set the project name correct for your build. At the moment this is not possible within the build.gradle
file. Instead, you have to create a settings.gradle
file in your root directory. This settings.gradle
file should have this one liner included:
rootProject.name = 'project1'
这篇关于Java插件中的Gradle - jar文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!