Delegate build and run actions to Maven
If you want to build your project and run Maven goals through Maven, you need to delegate all those actions to Maven with the Delegate IDE build/run actions to maven option located in the Maven settings.
In this case when you build a project (
HotSwap is also gets triggered and the classes are reloaded during a debugging process.
Build a project with Maven
Click
in the Maven Projects tool window. Alternatively, on the main menu select .
Click Maven and from the list, select Runner.
On the Runner page, select Delegate IDE build/run actions to maven.
Click OK.
Open any Java project with the pom.xml file.
Invoke the Build Project action (Ctrl+F9). Maven compiles the code and displays it in the Build tool window.
If you run your main method (Ctrl+Shift+F10), IntelliJ IDEA will also use Maven to run the class.