0

我的项目有一个子项目“核心”,并且在核心内部我想要一个单独的子项目“强制”。它所要做的就是生成一个源文件并对其进行编译,但这取决于已编译的“核心”,因为代码生成器就在那里。我希望将 .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 存在于“核心”的子目录中,或者这会扰乱 gradle 的依赖分析?

4

1 回答 1

0

事实证明,处理这个问题的更好方法与 samples/java/withIntegrationTests 中的 integrationTest 示例非常相似。我为代码生成器创建了自己的 sourceSet,并且能够从核心子项目中完成我需要的一切,而不是将这一部分分离到它自己的子项目中。

于 2014-02-28T20:18:52.363 回答