Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using IntelliJ IDEA with Maven projects that use the "generate-sources" or "process-classes" lifecycle phases

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?

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?

like image 693
Feuermurmel Avatar asked Feb 13 '14 12:02

Feuermurmel


People also ask

How do I get Maven lifecycle in IntelliJ?

In the Maven tool window, click Lifecycle to open a list of Maven goals. Right-click the desired goal and from the context menu select Run 'name of the goal'. IntelliJ IDEA runs the specified goal and adds it to the Run Configurations node.

What are the Maven lifecycle phases?

There are three built-in build lifecycles: default, clean and site. The default lifecycle handles your project deployment, the clean lifecycle handles project cleaning, while the site lifecycle handles the creation of your project's web site.

What is a Maven list its phases or life cycle command to run our project through the Maven?

Maven makes the day-to-day work of Java developers easier and helps with the building and running of any Java-based project. Maven Lifecycle: Below is a representation of the default Maven lifecycle and its 8 steps: Validate, Compile, Test, Package, Integration test, Verify, Install and Deploy.


1 Answers

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.

like image 157
KMR Avatar answered Oct 15 '22 04:10

KMR