Using Intellij to Build War and Deploy to Tomcat

Checklist of things you can do to verify where things go wrong:

  1. Manually build the artifacts using Build > Build artifacts.
  2. Verify if the artifact is in the expected output directory (out/artifacts/xxx).
  3. If not, go to File > Project structure > Artifacts
  4. Select the artifact file in question (project_name in this case).
  5. Verify if the output directory is correct. Optionally try to create this directory yourselves in case IntelliJ doesn't do it (although this would surprise me)
  6. Verify if the contents are correct.
  7. Optionally check "Build on make" to always have the latest version of your code deployed whenever you run the server.

Note that for deploying WAR files to a Tomcat, you should prefer to use the exploded WAR. This makes deploying/testing/debugging significantly faster.


I got this error when I tried to launch an app by using Run. The problem was that for some reason the WAR file wasn't deployed even after selecting Build->Build Artifacts. Solution: I closed Idea then reimported the project and choose as artifact war-exploded. This time the deploy worked.