摇篮。如何为子项目列表指定共享配置?

时间:2012-04-11 05:42:55

标签: build share gradle subproject

subprojectsallprojects属性,但我怎样才能真正列出已知的项目子集?我尝试以下方法:

[project(':child1'), project(':child2')] {
    ...
}

的灵感来自println allprojects

的输出
[project ':stripper', project ':webui', project ':wikidigest']

但它不起作用。日志输出:

* What went wrong:
A problem occurred evaluating root project 'projects'.
> No signature of method: java.util.ArrayList.call() is applicable for argument types: (build_1ngb77rivv12hrhe33snq4jat0$_run_closure4) values: [build_1ngb77rivv12hrhe33snq4jat0$_run_closure4@38a3f968]
  Possible solutions: tail(), wait(), last(), any(), max(), wait(long)

1 个答案:

答案 0 :(得分:2)

解决方案是逐个打包到configure()

configure([project(':child1'), project(':child2')]) {
    ...
}