dependencies - 没有自己目录的gradle子项目

标签 dependencies gradle subproject

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

相关文章:

ios - xcode 子项目缺少依赖目标

c# - 矩形不改变颜色WPF

android - 错误 : Could not get unknown property 'iosX64' for KotlinTargetPreset in Android Studio 3. 1.4?

spring - 在以下任何来源中均未找到插件 [id : 'io.spring.dependency-management' , 版本 : '1.0.5.RELEASE' , 应用:false]:

java - 使用 Jetbrains IDES 在反编译的 jar 文件中查找文本

spring - Gradle 多模块项目 : Apply module dependency to all subprojects except for itself

dependency-injection - Gradle 无法使用 fileTree 将依赖项注入(inject)子项目

python - 依赖项不适用于我的应用程序

java - 在非 Android Java 项目中使用 Android 应用程序的一部分

c++ - 为内存和外部依赖管理重新组织 C++ 代码