title: Ant task for deploying Java EE app to TomEE as WAR, instead of as EAR
body: <p>Tools and technologies used: Eclipse, Apache TomEE+, MySQL, Java EE/EJB, MVC/Servlets+JSP, OpenJPA.</p>
  
  <p>I have an application that is working fine. Its simple Java EE web app, front layers are implemented as MVC pattern, JSP + Servlets, and server part works with EJB's - stateless session and entity beans, and openJPA as persistence provider. 
  This app is being deployed as EAR archive to [tomee]/webapps folder. I am using Ant tool for doing specific tasks. Session and entity beans are packaged as jar archive. War archive contains web part, JSP's, servlets and entities. And then, jar and war are packaged to ear archive and copied/deployed to [tomee]/webapps folder.</p>
  
  <p>Now, i would like instead of ear to deploy everything as one war file. 
  Here are ant tasks for war, jar and then ear archiving:</p>
  
  <pre><code>&lt;!-- War --&gt;
  &lt;target name="war" depends="compile"&gt;
      &lt;war destfile="${dist}/${warname}" webxml="${web}/WEB-INF/web.xml"&gt;
        &lt;zipfileset dir="${web}"&gt;
          &lt;include name="*.jsp"/&gt;
          &lt;include name="*.css"/&gt;
          &lt;include name="*.js"/&gt;
        &lt;/zipfileset&gt;
        &lt;classes dir="build"&gt;
          &lt;include name="rs/ac/uns/ftn/informatika/mbs2/vezbe09/primer01/server/servlet/*.class"/&gt;
          &lt;include name="rs/ac/uns/ftn/informatika/mbs2/vezbe09/primer01/server/entity/*.class"/&gt;
          &lt;include name="messages/*.properties"/&gt;  
          &lt;include name="log4j.properties"/&gt;
        &lt;/classes&gt;
        &lt;lib dir="lib"&gt;
          &lt;include name="log4j-1.2.8.jar"/&gt;
        &lt;/lib&gt;
      &lt;/war&gt;
  &lt;/target&gt;
  
  &lt;!-- Jar --&gt;    
  &lt;target name="jar" depends="compile"&gt;
      &lt;mkdir dir="${dist}"/&gt;
      &lt;jar destfile="${dist}/${jarname}"&gt;
          &lt;zipfileset dir="${build}/META-INF" prefix="META-INF"&gt;
              &lt;include name="persistence.xml"/&gt;
          &lt;/zipfileset&gt;           
          &lt;zipfileset dir="${build}"&gt;
              &lt;include name="rs/ac/uns/ftn/informatika/mbs2/vezbe09/primer01/server/session/*.class"/&gt;
              &lt;include name="rs/ac/uns/ftn/informatika/mbs2/vezbe09/primer01/server/entity/*.class"/&gt;
          &lt;/zipfileset&gt;                   
      &lt;/jar&gt;
  &lt;/target&gt;
  
  &lt;!-- Ear --&gt;
  &lt;target name="ear" depends="jar,war"&gt;
      &lt;mkdir dir="${dist}"/&gt;
      &lt;ear destfile="${dist}/${earname}" appxml="${build}/META-INF/application.xml"&gt;
          &lt;zipfileset dir="${dist}"&gt;
              &lt;include name="${jarname}"/&gt;
              &lt;include name="${warname}"/&gt;
          &lt;/zipfileset&gt;
      &lt;/ear&gt;
  &lt;/target&gt;
  
  &lt;!-- Deploy  --&gt;
  &lt;target name="deploy" depends="ear"&gt;
      &lt;copy todir="${tomee.dir}/webapps"&gt;
          &lt;fileset dir="${dist}" includes="${earname}" /&gt;
      &lt;/copy&gt;     
  &lt;/target&gt;
  </code></pre>
  
  <p>How should look an ant task for packaging everything in one war file?</p>