简体   繁体   English

如何在多项目项目中拥有两个不同的 Gradle 版本?

[英]How can I have two different Gradle versions in a multi-project project?

I am currently attempting to determine the feasibility of making a particular kind of Minecraft mod using the Forge modding framework.我目前正在尝试确定使用 Forge modding 框架制作特定类型的 Minecraft mod 的可行性。 One of the peculiarities of this framework is that it requires a custom Gradle plugin to build the mods (for various copyright-related reasons, given that Minecraft is not FOSS), but this Gradle plugin only works with ancient versions of Gradle.这个框架的一个特点是它需要一个自定义的 Gradle 插件来构建 mods(出于各种版权相关的原因,因为 Minecraft 不是 FOSS),但是这个 Gradle 插件只适用于旧版本的 Gradle。 Furthermore, I want to be able to target multiple Minecraft versions in the same code base (essentially, keeping as much common code as possible in shared java library projects), but that requires that I have two sub-projects with different versions of ForgeGradle (Forge's Gradle plugin), and of course those versions require different Gradle versions.此外,我希望能够在同一代码库中定位多个 Minecraft 版本(本质上,在共享 Java 库项目中保留尽可能多的通用代码),但这需要我有两个具有不同 ForgeGradle 版本的子项目( Forge 的 Gradle 插件),当然这些版本需要不同的 Gradle 版本。 I also prefer to use the newest Gradle for the non-Forge parts of this project, which is, of course, incompatible with ForgeGradle.对于这个项目的非 Forge 部分,我也更喜欢使用最新的 Gradle,这当然与 ForgeGradle 不兼容。 As such, I ask, how can I have different versions of Gradle for different sub-projects in a multi-project Gradle project?因此,我问,如何在多项目 Gradle 项目中为不同的子项目使用不同版本的 Gradle? If this isn't possible, how can I automate the connection between these projects in an IDE-friendly and single-git-repository-friendly way (mainly IntelliJ Idea Community Edition)?如果这是不可能的,我怎样才能以 IDE 友好和单一 git-repository 友好的方式(主要是 IntelliJ Idea 社区版)自动化这些项目之间的连接? I intend for the versions of the repository to be tracked as a single unit, hence the need for them to be in the same git repo.我打算将存储库的版本作为单个单元进行跟踪,因此需要将它们放在同一个 git 存储库中。

Gradle does not support multiple Gradle versions in the same multi project build. Gradle 在同一个多项目构建中不支持多个 Gradle 版本。 This is also not supported in composite builds.这在复合构建中也不支持。

Given the constraints, the easiest solution would be to work with a local repository to which you publish and from which you fetch your cross project dependencies.鉴于这些限制,最简单的解决方案是使用您发布到的本地存储库并从中获取您的跨项目依赖项。

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

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