本文介绍了将IntelliJ IDEA与使用“generate-sources”的Maven项目一起使用或“过程类”或“过程类”。生命周期阶段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 Maven 项目,该项目使用绑定到 generate-sources 进程的插件 - 类生命周期阶段。将项目导入 IntelliJ IDEA 时,IDEA将接管项目源的编译,并根据 pom.xml 中的设置进行编译。但它没有实现任何其他生命周期阶段。如何在IntelliJ IDEA中构建项目时执行这些其他生命周期阶段?

I'm working on a Maven project that uses a plugins bound to the generate-sources and process-classes lifecycle phases. When the project is imported into IntelliJ IDEA, IDEA takes over compilation of the project sources and does so according to the settings in the pom.xml. But it does not implement any of the other lifecycle phases. How can I get these other lifecycle phases to be executed when building the project from within IntelliJ IDEA?

我知道我可以创建一个专门运行Maven的运行配置 process-classes 阶段,然后将此运行配置设置为在其他配置之前运行,但这将构建所有模块,而不仅仅是该特定运行配置所需的模块,除此之外比IntelliJ IDEA的构建长一个数量级。有没有更好的方法?

I know that I can create a run configuration that specifically runs Maven with the process-classes phase and then set this run configuration up to run before other configurations, but that will build all modules and not just the modules necessary for that particular run configuration, besides it taking an order of magnitude longer than a build from with IntelliJ IDEA. Is there a better way?

推荐答案

不幸的是,IntelliJ中maven生命周期的唯一两个选项是Basic和Full( Cog - >取消仅显示基本阶段。)

Unfortunately, the only two options for the maven Lifecycle in IntelliJ are Basic and Full (Cog -> untick Show Basic Phases Only).

如果您对运行全套阶段感到满意可以只运行完整集,但最好的选择只是将所有适当的选项添加到运行配置中并自行运行。

If you are happy with it running the full suite of phases you can just run the full set, but otherwise the best option is just to add all the appropriate ones to a run configuration and run that on its own.

这篇关于将IntelliJ IDEA与使用“generate-sources”的Maven项目一起使用或“过程类”或“过程类”。生命周期阶段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 18:49