How to build file include jar in war file
843841Dec 18 2006 — edited Dec 19 2006I created 2 project and I want to combine them.The build file suppose to compile servlet file,copy jar file and create war file.The problem is the build file. I dont know how to combine them(combine project 1 in project 2,all source code in project 2 only).I edited project 2,but I failed to include the jar file.Please help.I'm a beginner.Thanks
1st project
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="appletest" default="copy" basedir=".">
<property environment="env" />
<property name="app.name" value="appletest" />
<property name="applet.name" value="//home/st02070h/workspace/dbprex" />
<target name="copy">
<description>create directory and copy</description>
<mkdir dir="/home/st02070h/apache-tomcat-5.5.17/webapps/appletest" />
<mkdir dir="/home/st02070h/apache-tomcat-5.5.17/webapps/appletest/WEB_INF" />
<copy todir="/home/st02070h/apache-tomcat-5.5.17/webapps/appletest">
<fileset dir="." includes="**/*.jsp" />
</copy>
<copy todir="/home/st02070h/apache-tomcat-5.5.17/webapps/appletest/jsp">
<fileset dir="${applet.name}" includes="*.jar" />
</copy>
</target>
</project>
2nd project
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="configtest2" default="build" basedir=".">
<property environment="env" />
<property name="app.name" value="configtest2" />
<target name="build">
<description>compile java source file</description>
<javac srcdir="WEB-INF" destdir="classes">
<classpath>
<pathelement location=
"/home/st02070h/apache-tomcat-5.5.17/common/lib/servlet-api.jar" />
</classpath>
</javac>
</target>
<target name="archive" depends="build">
<description>create WAR file</description>
<war warfile="${app.name}.war" webxml="web.xml">
<classes dir="classes" />
<fileset dir="." includes="**/*.jsp" />
</war>
</target>
</project>
I tried this
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="configtest2" default="build" basedir=".">
<property environment="env" />
<property name="app.name" value="configtest2" />
<property name="applet.name" value="//home/st02070h/workspace/dbprex" />
<target name="build">
<description>compile JAVA file and copy jar file</description>
<javac srcdir="WEB-INF" destdir="classes">
<classpath>
<pathelement location=
"/home/st02070h/apache-tomcat-5.5.17/common/lib/servlet-api.jar" />
</classpath>
</javac>
<copy todir="/home/st02070h/apache-tomcat-5.5.17/webapps/configtest2/jsp">
<fileset dir="${applet.name}" includes="*.jar" />
</copy>
</target>
<target name="archive" depends="build">
<description>create WAR file</description>
<war warfile="${app.name}.war" webxml="web.xml">
<classes dir="classes" />
<fileset dir="." includes="**/*.jsp" />
<fileset dir="${applet.name}" includes="*.jar" />
</war>
</target>
</project>
Message was edited by:
hankeymeal