【问题标题】:gradle subproject that doesn't have its own directory没有自己的目录的 gradle 子项目
【发布时间】:2014-02-26 23:09:57
【问题描述】:

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

【问题讨论】:

    标签: dependencies gradle subproject


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-17
      • 2014-01-28
      • 1970-01-01
      • 2013-10-18
      • 2019-10-20
      • 1970-01-01
      相关资源
      最近更新 更多