user1745356
user1745356

Reputation: 4693

Difference between compiling java app with maven and intellij idea

I develop a java web app in intellij which is then deployed to tomcat (tomcat integrated with intellij). It is a maven project. So, usually I do this: I run package goal in maven. Then I run tomcat in intellij. Or I may not package it with maven and run tomcat in intellij right away.
So what is the difference then?

If I package it with maven and then run tomcat in intellij does the source code get compiled and packaged again and then deployed? Or just war produced by maven goal is deployed to tomcat? Well if I don't package it and just run tomcat in intellij then it obviously gets compiled by intellij goal. I am a bit confused here.

Upvotes: 2

Views: 558

Answers (1)

Frederic Close
Frederic Close

Reputation: 9649

You don't need to run mvn package before running your webapp within Intellij.
What you can do is configure your Tomcat server to run your war exploded.

In the run/debug configuration, you can specify before launch operation. By default,

  • a make is done
  • build artifact in exploded mode is done

If you prefer to work with a-non exploded war, last step would be build artifact instead of build exploded artifact.

enter image description here

Upvotes: 3

Related Questions