Gradle:如何使用并行项目配置多项目设置

发布于 2024-11-28 15:40:22 字数 528 浏览 4 评论 0原文

我们有一个像这样设置的旧项目:

.
├── customizationProject
│   ├── ejb
│   └── services
├── projectA
│   ├── ejb
│   └── shared
├── projectB
│   └── ejb
└── projectC
    ├── ejb
    └── services

其想法是,customizationProject 是交付的应用程序的最终组装发生的地方,实际上可能有多个 customizationProjects 并且它们可能包含多个配置。然而,这并不是我想要解决的问题。

我想让customizationProject成为gradle项目的逻辑根项目。 我如何配置各个项目,以便它们 a)知道它们是多项目构建的一部分 b) 可以在不同的范围内正确执行,例如仅运行一个子项目的测试,同时还允许在所有项目中执行所有测试?

We have an old project that is set up like this:

.
├── customizationProject
│   ├── ejb
│   └── services
├── projectA
│   ├── ejb
│   └── shared
├── projectB
│   └── ejb
└── projectC
    ├── ejb
    └── services

The idea is that the customizationProject is where the final assembly of the delivered application happends, there might in fact be multiple customizationProjects and they might include multiple configurations. That, however is not the problem I'm tyring to solve.

I want to make the customizationProject the logical root project of the gradle projects.
How do I configure the individual projects, so that they
a) know they're part of a multiproject build
b) can be properly executed, with different scopes, e.g. just running the tests of one subproject, while also allowing all tests to be executed accross all the projects?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

音栖息无 2024-12-05 15:40:22

这是一个相当容易用 Gradle 支持的结构。将settings.gradle 文件添加到您的customizationProject 目录,其中包含以下内容:

includeFlat 'projectA', 'projectB', 'projectC'

您可以从命令行确认项目结构:

$ gradle projects
:projects

------------------------------------------------------------
Root Project
------------------------------------------------------------

Root project 'customizationProject'
+--- Project ':projectA'
+--- Project ':projectB'
\--- Project ':projectC'

includeFlat 方法的说明可在 Gradle 文档

希望有帮助!

This is a fairly easy structure to support with Gradle. Add a settings.gradle file to your customizationProject directory with this content:

includeFlat 'projectA', 'projectB', 'projectC'

And you can confirm the project structure from the command line:

$ gradle projects
:projects

------------------------------------------------------------
Root Project
------------------------------------------------------------

Root project 'customizationProject'
+--- Project ':projectA'
+--- Project ':projectB'
\--- Project ':projectC'

The description of the includeFlat method is available in the Gradle documentation.

Hope that helps!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文