且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

通过在Maven中运行项目的Java类来生成源

更新时间:2022-06-12 17:18:09

您可以在generate-sources阶段执行maven-compile-plugin.只需在现有执行之前添加另一个执行,然后对其进行配置,以便它可以为生成器选择源.

You can execute the maven-compile-plugin in the generate-sources phase. Just add another execution before the existing execution and configure it so that it just picks up the sources for the generator.

或将项目分为两部分:使用单独的POM构建生成器,并将生成器库包括为生成源的POM的依赖项.

Or split the project in two: build the generator with a separate POM and include the generator library as a dependency to the POM that's generating the sources.

我个人将拆分项目.使构建文件更整洁,更易于维护.

Personally I would split the project. Keeps the build files cleaner and easier to maintain.