title: How to create a WAR file using the commandline?
body: <p>I installed JBoss Developer Studio and it's possible to create a WAR file by "right mouse project > Export > WAR file" but I want to export my project to a WAR file using the commandline.</p>
  
  <p>I have maven installed which is one of the requirements of the Studio and I read that I can generate a WAR file using maven but I require a file called pom.xml. When I searched through my workspace and project, pom.xml was missing. I may need to manually create pom.xml but I'm unsure how to.</p>
  
  <p>My directory tree for my project is the following:</p>
  
  <pre><code>Siesta
  ├── build
  │   └── classes
  ├── src
  └── WebContent
      ├── extjs
      ├── extjs-4.2.0
      ├── extjs-4.2.2
      ├── index.jsp
      ├── META-INF
      ├── siesta
      ├── tests
      └── WEB-INF
  </code></pre>
  
  <p>How do I create a WAR file for my Maven / JBoss project using the command line? I use Linux and would prefer not having to create a pom.xml file but if there isn't another way, then I'll use the xml file to generate the war file.</p>
  
  <p><strong>Edit:</strong> </p>
  
  <p>So jar is the way to go to create a war file. I wrote up a tiny script that will create a war file for me for a specific directory. </p>
  
  <pre><code>#!/bin/bash
  cd Siesta/WebContent/
  jar -cvf ../../Siesta.war *
  cd -
  </code></pre>
  
  <p>Then if you open the war file in a zip utility or archive manager in ubuntu, you'll see this structure</p>
  
  <pre><code>    ├── extjs
      ├── extjs-4.2.0
      ├── extjs-4.2.2
      ├── index.jsp
      ├── META-INF
      ├── siesta
      ├── tests
      └── WEB-INF
  </code></pre>
  
  <p>I have to CD into the directory that I want to create a war file of which is kind of annoying. I think there may be a better way to do it using jar's -C option but when I used "jar -cvf Siesta.war -C Siesta/WebContent *" it didn't have the same result.</p>
  
  <p><strong>Edit2:</strong></p>
  
  <pre><code>jar -cvf my-app.war myfolder/
  </code></pre>
  
  <p>For my application to work on TomCat, I use the following:</p>
  
  <pre><code>cd Siesta/WebContent
  jar -cvf Siesta.war *
  </code></pre>