多模块项目中的 requiresDependencyResolution

requiresDependencyResolution in a multi-module project

如果你想 运行 一个在其 @Mojo 注释中有 requiresDependencyResolution = ResolutionScope.COMPILE 的 Maven 目标,即要求在它 运行 之前解决所有依赖关系,你在多模块项目中遇到问题。

如果一个模块引用另一个模块,则另一个模块不存在(当您在父或子上使用 plugin:some-goal 启动目标时),解析失败。

如何在多模块项目的上下文中使用这样的 Maven 插件?

诀窍是尽可能使用 requiresDependencyCollection,因为它不需要构建其他模块。