I am creating an ant script to build and deploy a project. My project structure is as follows:
Projectname
--src
--tst
--lib ( I have 5 jars here)
--resources
--WebContent
--META-INF
--WEB-INF
--lib (I have 3 jars here)
--properties
--templates
--stylesheets
--web.xml
My requirement is I have to write an ant script to build the project and create a war file in the staging environment (not local). The war should contain all the jar files available in the classpath ( classpath has more than 50 jars). But when I run my ant script it shows me only 8 jars, that are available in lib folders and does not include the jars from classpath.
How to add classpath while creating a War file? Below is the script I have written for creating a war.
<target name="war" description="Bundles the application as a WAR file" depends="build">
<echo> === PACKAGE WAR ====== </echo>
<delete dir="target" failonerror="false"/>
<mkdir dir="target"/>
<war destfile="target/test.war" needxmlfile="false" >
<fileset dir="WebRoot">
<include name="**/*.*"/>
</fileset>
<lib dir ="lib">
<include name="**/*.*"/>
</lib>
<classes dir="WebContent/WEB-INF/classes"/>
</war>
</target>
Classpath is as follows in the ant script.
<property name="ExternalJars.location" value="../ExternalJars"/>
<path id="Services.classpath">
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</path>