如何在Gradle中重命名项目而不是使用文件夹名称? [英] how to rename the project in gradle instead of using folder name?

查看:110
本文介绍了如何在Gradle中重命名项目而不是使用文件夹名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们希望有各子项目被称为SDI-xxx和SDI-YYY所以当我们运行gradle这个日食它的.project正确生成Eclipse项目的名称,当我们建立它创建了一个名为SDI-XXXX一个jar文件。 jar和sid-yyyy.jar。我已经看到了这个地方,但在我的生活中,我无法在文档中找到它(文档非常庞大,我知道我在那里看到了它)。

We would like to have all subprojects be called sdi-xxx and sdi-yyy so when we run gradle eclipse it generates eclipse project names correctly in .project and when we build it creates a jar file with the name sdi-xxxx.jar and sid-yyyy.jar. I have seen this somewhere but for the life of me, I can't find it in the doc(that doc is huge and I know I saw it there somewhere).

感谢,
院长

推荐答案

settings.gradle:

settings.gradle:

prefixProjectName(rootProject, "sdi-")

def prefixProjectName(project, prefix) {
  project.name = prefix + project.name
  project.children.each { prefixProjectName(it, prefix) }
}

这篇关于如何在Gradle中重命名项目而不是使用文件夹名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆