具有多个gradle子项目的IntelliJ IDEA [英] IntelliJ IDEA with multiple gradle subprojects
问题描述
我正在处理多个具有内部和外部依赖的Gradle项目,到目前为止,我很高兴得益于Gradle的依赖管理,我可以在不影响使用该库的每个应用程序的情况下修改库项目。
当我需要修改一个库项目并使用它进行测试时,我需要执行以下操作:
build.properties
以引用新版本的库项目
现在它变得相当复杂。我可以配置IntelliJ IDEA,以便
- 我所有的Gradle项目都在一个窗口中,就像下面的屏幕截图一样,这是Twitter的Finagle使用其导入
的pom.xml
。可悲的是,IntelliJ的JetGradle插件似乎并不了解Gradle子项目。
- 当
build.properties
的依赖项是我的子项目,从本地快照中读取依赖项,否则从Gradle仓库中下载它们
如果你想在一个IDEA窗口中打开所有的项目,你必须将它们聚合到一个多项目构建中,至少在IDEA 13击中市场之前。在IDEA 13之前,最好使用Gradle的IDEA集成。一旦你有了一个多项目构建,你需要做的就是在根构建脚本中添加 allprojects {apply plugin:idea}
,运行 gradle(cleanIdea)idea
,然后打开生成的IDEA项目。
I'm working on multiple Gradle projects with internal and external dependencies, and so far I am happy that thanks to Gradle's dependency management I can modify a library project without affecting every application that uses the library.
When I need to modify a library project and test it using an application project that uses it, I need to do the following,
- Modify the library project and commit to SCM
- Trigger CI to build the library project and push it to my Gradle repository
- Update the application project's
build.properties
to refer to the new version of library project - Iterate the above steps until everything works and there is no bug
So it became quite combersome now. Can I configure IntelliJ IDEA so that
- All my Gradle projects are in one window, like the screenshot below, which is Twitter's Finagle imported using its
pom.xml
. Sadly IntelliJ's JetGradle plugin doesn't seem to understand Gradle subprojects.
- When
build.properties
's dependencies are my subprojects, read dependency from local snapshot, otherwise download them from the Gradle repository
Thanks.
If you want to open all projects in a single IDEA window, you'll have to aggregate them into a multi-project build, at least until IDEA 13 hits the market. Before IDEA 13, it's better to use Gradle's IDEA integration. Once you have a multi-project build, all you need to do is to add allprojects { apply plugin: "idea" }
to the root build script, run gradle (cleanIdea) idea
, then open the generated IDEA project.
这篇关于具有多个gradle子项目的IntelliJ IDEA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!