简体   繁体   English

具有多个Gradle项目的Intellij IDEA

[英]Intellij IDEA With Multiple Gradle Projects

I am working on two Gradle projects. 我正在研究两个Gradle项目。 One of these projects is a supporting library that will be used by other projects in the future so project A depends on project B but not as a 'multi module project'. 其中一个项目是未来其他项目将使用的支持库,因此项目A依赖于项目B而不是“多模块项目”。 The dependency is to be resolved through the artifact repo so project a declares it as a compile dependency using it's maven coordinates. 依赖关系将通过工件repo解决,因此项目a使用它的maven坐标将其声明为编译依赖关系。

My problem is when working on these two projects in IntelliJ changes to project B aren't made available to project A until I install it (using the Gradle Maven plugin) in my local repo. 我的问题是当在IntelliJ中处理这两个项目时,在我的本地仓库中安装它(使用Gradle Maven插件)之前,对项目B的更改不可用于项目A. This is kind of annoying and slows down my workflow. 这有点烦人,减慢了我的工作流程。 Is there a way to get IntelliJ to automatically update the dependency internally? 有没有办法让IntelliJ在内部自动更新依赖项?

This is supported in the latest versions of Gradle and IntelliJ. 最新版本的Gradle和IntelliJ支持此功能。 It is known as a Composite Build . 它被称为复合构建

Composite builds can be declared in the project's settings.gradle file as follows: 可以在项目的settings.gradle文件中声明复合构建,如下所示:

includeBuild '../my-app'

or by using the --include-build command line argument: 或者使用--include-build命令行参数:

$ gradle --include-build ../my-utils run

Take a look at the Composite Builds with Gradle and IntelliJ IDEA Webinar for instructions on how to configure the integration. 请参阅使用Gradle和IntelliJ IDEA网络研讨会Composite Builds,了解有关如何配置集成的说明。

在IDEA 2017中,您可以右键单击gradle模块并使用Composite Build Configuration将当前模块链接到当前工作空间中已打开的一个或多个gradle模块。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM