sebaszczen
sebaszczen

Reputation: 71

What is the difference between Intellij Run and Maven app axecuting

If i use maven in intellij what happens when i hit run button? Is it the same as maven:mvn compile + mvn exec:java? If not, what is the difference?

Upvotes: 2

Views: 1517

Answers (1)

CrazyCoder
CrazyCoder

Reputation: 402235

Results can be different depending on the Maven project configuration. Check this answer for the details how IntelliJ IDEA Maven integration works.

IntelliJ IDEA Run is using the special agent which provides support for thread dumps and graceful exit that can be useful for analyzing application lockups and testing shutdown hooks. The agent can also shorten the too long command line which exceed OS limits and can cause an issue when running otherwise.

Options used in IntelliJ IDEA Run/Debug configuration can be different from what you have defined for mvn exec:java.

Compilation is also performed differently. IntelliJ IDEA compiler is incremental, can build multiple modules in parallel and is usually faster. It's not using javac, but works via the compiler API.

In most cases your app will work exactly the same, but you should keep in mind that compilation and execution is performed differently.

If you you have any issues and want IntelliJ IDEA to build and run exactly the same as the command line Maven, there is now an option for that (Delegate IDE build/run actions to Maven).

Upvotes: 4

Related Questions