title: Using Intellij to Build War and Deploy to Tomcat
body: <p>My basic workflow is in terminal <code>mvn clean install</code> on my base directory. This creates a target directory with a WAR file. I copy that war file into the webapps directory of my Tomcat.</p>
  <p>If I make changes I obviously have to repeat the process which is tedious. I am using Intellij Ultimate 13.1.6 and I know it is possible to have all of this done through the IDE based on <a href="https://www.jetbrains.com/idea/help/configuring-web-application-deployment.html" rel="noreferrer">this guide</a>.</p>
  <p>So before I begin I run <code>mvn clean</code> on my base which removes the target directory.</p>
  <p>Now to start I when into the Project Structure --&gt; Artifacts and created a new Web Application: Archive. I named it project_name and it had a different output directory by default (baseDir/out/artifacts/project_name vs baseDir/target) which I left everything default and hit ok.</p>
  <p>Now I go to Run --&gt; Edit Configurations and create a new Local Tomcat Server using the following settings<a href="https://i.stack.imgur.com/wG4EL.png" rel="noreferrer"><img src="https://i.stack.imgur.com/wG4EL.png" alt="enter image description here" /></a></p>
  <p>and in the Deployment Tab I add the artifact which is built in my Before launch as seen in my picture. Pretty straightforward.</p>
  <p>However, whenever I run the server through Intellij it successfully starts but nothing is deployed. I get the error:</p>
  <p><code>Artifact project_name: com.intellij.javaee.oss.admin.jmx.JmxAdminException: com.intellij.execution.ExecutionException: /Users/path/to/workspace/project_name/out/artifacts/project_name/project_name.war not found for the web module.</code></p>
  <p>And I double check my directory and as seen in the error, nothing is created. Not even the out directory.</p>
  <p>What am I doing wrong? I know one workaround is to go back to terminal, run <code>mvn clean install</code> and with that .war file that is created, put that into the deployment configuration. I felt like that was more of a hack since I am still doing it through command line and if I don't have it already built I can't set the target as a directory to find the war file.</p>
  <p>Any assistance is appreciated.</p>