动态添加项目到maven构建reactor?

发布于 2024-12-12 08:10:45 字数 372 浏览 0 评论 0原文

我写了一个maven插件,它根据某种定义语言生成Java源代码。
生成的源代码应分为几个 jar 文件(接口、实现等)。
我想构建包含定义语言以及生成的源的项目,但我不确定最好的方法是什么。
我想扩展我的 Maven 插件,为每个 jar 生成一个新的 Maven 项目,并将它们动态添加到当前运行的 Maven 构建反应器中。

是否可以在构建运行时向构建反应器添加新的 Maven 项目?当 maven 解析用于构建反应器的目录结构时,我可以生成新的 Maven 项目吗? (也许在 validate 阶段?)

有人知道如何在同一个反应器中编译生成的 Maven 项目吗?

预先非常感谢

I wrote a maven plugin that generates Java source code based on some definition language.
The generated source code should be split up into several jar files (interfaces, implementation, etc.).
I would like to build my project containing the definition language together with the generated sources but I'm not sure what the best way is.
I thought of extending my maven plugin to generate for each jar a new maven project and add them dynamically to the current running maven build reactor.

Is it possible to add new maven projects to the build reactor while the build is running? or Could I generate new maven projects while maven is parsing the directory structure for building the reactor? (Maybe in the validate phase?)

Does anyone have a better idea how to compile the generated maven projects in the same reactor?

Many thanks in advance

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

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

发布评论

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

评论(1

孤檠 2024-12-19 08:10:45

就我个人而言,我建议只使用一个具有多个工件的项目

  • 生成源代码
  • 编译所有源代码
  • 使用多个程序集插件配置将生成的类文件拆分为多个罐子

我相信您可以使用不同的分类器生成这些不同的罐子,然后将它们依赖为其他 Maven 模块/项目中的独立资源。

personally, i would recommend just using one project with multiple artifacts

  • generate the sources
  • compile all the sources
  • use multiple assembly plugin configs to split the resulting class files into multiple jars

i believe you could generate these various jars with different classifiers and then depend on them as independent resources in other maven modules/projects.

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