Gradle:如何使用并行项目配置多项目设置
我们有一个像这样设置的旧项目:
.
├── 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个相当容易用 Gradle 支持的结构。将settings.gradle 文件添加到您的customizationProject 目录,其中包含以下内容:
您可以从命令行确认项目结构:
includeFlat 方法的说明可在 Gradle 文档。
希望有帮助!
This is a fairly easy structure to support with Gradle. Add a settings.gradle file to your customizationProject directory with this content:
And you can confirm the project structure from the command line:
The description of the includeFlat method is available in the Gradle documentation.
Hope that helps!