有没有办法将Gradle构建的公共部分分解/分解出来? [英] Is there a way to split/factor out common parts of Gradle build
问题描述
- 将主构建文件
拆分为更小的文件的一种方式 - 在其他独立构建中重用
构建的某些部分的方法
什么是最佳方式在Gradle中实现它?
Gradle 0.9允许您从另一个构建脚本中导入构建脚本。查看:使用外部构建脚本配置项目一>。基本上它是适用于:'other.gradle'
。
用户指南没有提及的一件事是'from'参数可以是一个URL,所以你可以通过HTTP将你的共享脚本提供给某个地方(例如你的Subversion版本库),然后从多个版本中导入它们。
We have several independent builds (each independent build is a multi-project build). The main build scripts become quite big as we have a set of common tasks reused by subprojects as well as there is a lot of repeation between indepedent builds. What we are looking for is:
- A way to split main build file into smaller files
- A way to reuse some parts of the build in other independent builds
What is the best way to achieve that in Gradle?
Gradle 0.9 allows you to import a build script from another build script. Have a look at: Configuring the project using an external build script. Basically it's apply from: 'other.gradle'
.
One thing the user guide doesn't mention is that the 'from' parameter can be a URL, so you can make your shared scripts available via HTTP somewhere (eg your subversion repository), and import them from multiple builds.
这篇关于有没有办法将Gradle构建的公共部分分解/分解出来?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!