Delegate build and run actions to Maven
If you want to build your project and execute run actions 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 (Run and Debug actions from the menu are executed with Maven. HotSwap is also gets triggered and the classes are reloaded during a debugging process.), IntelliJ IDEA invokes the appropriate Maven goals. Also, the
Build a project with Maven
Click in the Maven tool window. Alternatively, from the main menu select .
Click Maven and from the list, select Runner.
On the Runner page, select Delegate IDE build/run actions to maven.
Open any 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, for example, you run the main method Ctrl+Shift+F10 in your Java project, IntelliJ IDEA will also use Maven to run the class.