我的项目有一个子项目“核心”,而在核心内部,我想有一个单独的子项目“强制”。它要做的就是生成一个源文件并进行编译,但是它依赖于已编译的“核心”,因为代码生成器位于其中。我希望将.gradle文件称为coercion.gradle。
所以我在settings.gradle中尝试了
include 'core'
include "coercion"
project(':coercion').projectDir = file(settingsDir)
project(":coercion").buildFileName = "coercion.gradle"
这给我一个错误:
* What went wrong:
Could not select the default project for this build. Multiple projects
in this build have project directory
'/Users/montyzukowski/temboo/development/branches/capella-github-build':
[root project 'capella-github-build', project ':coercion']
是否有可能将coercion.gradle放在“core”的子目录中,还是会打乱gradle的依赖性分析?
最佳答案
事实证明,更好的处理方式与samples / java / withIntegrationTests中的integrationTest示例非常相似。我为代码生成器创建了自己的sourceSet,并且能够在核心子项目中完成我需要的所有工作,而不必将此部分分成自己的子项目。
关于dependencies - 没有自己目录的gradle子项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22055534/