Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

How to use ant to create a war file

  • 28-07-2008 10:38pm
    #1
    Registered Users, Registered Users 2 Posts: 1,559 ✭✭✭


    Im trying to learn to use ant.

    I want to be able to use it to create a war file of a jsp and servlet web application.

    I gave it a try anyway and made a build.xml file and ran ant makewar.
    So it did make the war which I put in the tomcat webapps directory.

    Then I ran tomcat and saw that the directories belonging to the application weren't structured properly.
    There was no jsp directory , the classes directory was not inside web-inf but out on its own and there was no jsp directory.

    I cant find any tutorials on how to create a directory structure within a war using ant.

    Can someone help?

    cheers.

    Heres the build.xml file I created so far with the stuff wrong in it ie. no directory structure.
    <?xml version="1.0"?>
      <project name="Ant Tutorial" basedir="." default="compile">
    
      <property name="build" location="C:/tomcat6.0.14/webapps/Login1/build"/>
      <property name="warname" location="C:/tomcat6.0.14/webapps/Login1/Login.war"/>
    
      <target name="create" depends="delete">
        <mkdir dir="${build}"/>
    
      </target>
    
      <target name="delete">
    
        <delete dir="${build}"/>
    
      </target>
    
      <target name="compile" depends="create">
        <javac srcdir="web-inf/classes" destdir="${build}"/>
        
      </target>
    
      <target name="makewar" depends="compile">
        
        <war destfile="${warname}" basedir="${build}" webxml="web-inf/web.xml">
    	
    	
        <include name="**/*.*"/>
        <exclude name="**/*Test*"/>
      
    
    
    
    	
    	
    	</war>
      </target>
    
    </project>
    


Comments

  • Registered Users, Registered Users 2 Posts: 6,240 ✭✭✭hussey


    http://www.roseindia.net/jboss/buildingwebapplicationwithant.shtml

    all you need

    but looks like you are missing the copying of files
    <copy todir="${warDir}/WEB-INF/classes">
    <fileset dir="${classdir}" includes="**/*.class" /> 
    </copy>
    
    <copy todir="${warDir}/WEB-INF">
    <fileset dir="${deploymentdescription}" includes="web.xml" /> 
    </copy>
    
    <copy todir="${warDir}">
    <fileset dir="${web}" includes="**/*.*" /> 
    </copy>
    


  • Registered Users, Registered Users 2 Posts: 1,559 ✭✭✭quinnd6


    That is excellent thank you very much


Advertisement