eclipse - Build WAR file using Ant for WebApplication -


i have created sample/default test web project in eclipse.

then using ant build , deploy. export default build.xml. ant doesn't have task create war file. so, have write task creating war.

i used below code.

<property name="app" value="testantwar"/>  <property name="tomcatwebapps" value="c:/apps/apache/jakarta/tomcat/tomcat-6/webapps" /> ...... <target name="buildwar" description="create war file">     <war basedir="${basedir}/build" destfile="${app}.war"          webxml="${basedir}/webcontent/web-inf/web.xml">           <fileset dir="webcontent"/>             <exclude name="web-inf/**" />                 <lib dir="webcontent/web-inf/lib"/>                 <lib dir="lib"/>                 <classes dir="build/classes"/>                 <classes dir="config"/>         <webinf dir="${basedir}/webcontent/web-inf/">             <include name="**/*.jar" />         </webinf>     </war>  </target> <target name="deploy" depends="buildwar" description="deploy in apache webapps">     <copy file="${app}.war" todir="${tomcatwebapps}" /> </target> 

when copy , paste generated war in webapps. after starting tomcat server, found war corrupt. war file 1kb file contains web.xml , manifest.mf.

i know:

  1. what war file contains , directory structure? optional , required files/folders?
  2. task syntax create , war through ant build.xml

i read answer answer1 , answer2 , couldn't in project.

your war file doesn't right me.

  1. content , web.xml should @ root.
  2. web-inf @ root.
  3. .class files in web-inf/classes
  4. .jar files in web-inf/lib

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -