×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Lim,
Assuming windows development environment :
1. Download ant ( http://ant.apache.org/bindownload.cgi )
2. Unzip into C:\Ant
3. Set an environment variable ANT_HOME to C:\Ant
4. Add %ANT_HOME%\bin to your path
create a build file ( build.xml ) in the root directory of your
application that looks something like this :
at the command line run ant. If all goes well your application should
compile and build into a war.
Pillai
<code>
<project name="egrepaircenter" default="main" basedir=".">
<!-- This is a basic build script, only the minimums here -->
<!-- Tell ant to use my environment variables -->
<property environment="env"/>
<property file="./build.properties"/>
<property name="build.compiler" value="modern"/>
<property name="app.name" value="sanjose"/>
<property name="app.path" value="/${app.name}"/>
<property name="build.srcdir" value="./com"/>
<property name="build.destdir" value="./build" />
<property name="build.jspoutdir" value="./jspout" />
<property name="build.assembledir" value="./assemble"/>
<property name="reportdir" value="${basedir}/reports"/>
<property name="tomcat.home" value="${env.CATALINA_HOME}"/>
<!-- Had to include ant.jar because of faulty implementation of
jspc task -->
<!-- Hate those jasper guys -->
<property name="ant.jar"
value="${env.ANT_HOME}\lib\ant.jar"/>
<property name="servlet.jar"
value="${env.CATALINA_HOME}\common\lib\servlet-api.jar"/>
<property name="jsp.jar"
value="${env.CATALINA_HOME}\common\lib\jsp-api.jar"/>
<property name="jaspercompiler.jar"
value="${env.CATALINA_HOME}\common\lib\jasper-compiler.jar"/>
<property name="jasperruntime.jar"
value="${env.CATALINA_HOME}\common\lib\jasper-runtime.jar"/>
<property name="junit.jar" value="C:\junit3.8.1\junit.jar"/>
<property name="war.file" value="sanjose"/>
<property name="war.file.name"
value="${war.file}-${build.DSTAMP}-${build.TSTAMP}.war"/>
<property name="deploy.dir" value="${tomcat.home}/webapps"/>
<property name="prod.deploy.dir" value="y:/tomcat4.1/webapps"/>
<property name="stage.deploy.dir" value="s:/tomcat4.1/webapps"/>
<!-- ==================== Init Target
=================================== -->
<target name="init">
<tstamp prefix="build"/>
<echo>Build starts at ${build.DSTAMP}-${build.TSTAMP}</echo>
</target>
<path id="project.class.path">
<fileset dir="./WEB-INF/lib/">
<include name="**/*.jar"/>
</fileset>
<pathelement path="${build.destdir}"/>
<pathelement location="${ant.jar}"/>
<pathelement location="${jaspercompiler.jar}"/>
<pathelement location="${jasperruntime.jar}"/>
<pathelement path="${servlet.jar}"/>
<pathelement path="${jsp.jar}"/>
</path>
<!-- ==================== Clean Target
=================================== -->
<target name="clean">
<delete dir="${build.destdir}" includeEmptyDirs="true" />
<delete dir="${build.assembledir}" includeEmptyDirs="true" />
<delete dir="${build.jspoutdir}" includeEmptyDirs="true" />
</target>
<!-- ==================== Prep Target
=================================== -->
<target name="prep">
<mkdir dir="${build.destdir}"/>
<mkdir dir="${build.assembledir}"/>
<mkdir dir="${build.jspoutdir}"/>
</target>
<!-- ==================== Compile Target
=================================== -->
<target name="compile">
<javac srcdir="${build.srcdir}"
destdir="${build.destdir}"
deprecation="on"
debug="on"
debuglevel="lines" >
<include name="**/*.java"/>
<exclude name="package.structurewebservices/client/**"/>
<exclude name="package.structureunittest/**"
unless="unit.test.flag" />
<classpath refid="project.class.path"/>
</javac>
<copy todir="${build.destdir}/com/olympus/eg/callcenter">
<fileset dir="./com/olympus/eg/callcenter"
includes="*.properties"/>
<fileset dir="./com/olympus/eg/callcenter" includes="*.pcml"/>
</copy>
</target>
<target name="war" depends="init" unless="unit.test.flag">
<java
classname="com.package.structurecallcenter.data.ConstantsEncrypter"
failonerror="true">
<arg value="./WEB-INF/conf/Repair.properties"/>
<classpath refid="project.class.path"/>
</java>
<copy file="./WEB-INF/web.xml"
tofile="${build.jspoutdir}/WEB-INF/web.xml" overwrite="yes">
<filterset>
<filter token="GENERATED" value="${generated_webxml}"/>
</filterset>
</copy>
<war
destfile="${war.file}-${build.DSTAMP}-${build.TSTAMP}.war"
webxml="./WEB-INF/web.xml">
<webinf dir="./WEB-INF" includes="**/*"
excludes="web.xml,CVS/**, **/*.jar, **/*.class"/>
<lib dir="./WEB-INF/lib"
excludes="CVS/**,commons-collections.jar,commons-dbcp.jar,commons-pool.jar"/>
<classes dir="${build.destdir}"/>
<classes dir="logconf"/>
<zipfileset dir="form" excludes="CVS/**" prefix="form"/>
<zipfileset dir="images" excludes="CVS/**"
prefix="images"/>
<zipfileset dir="javascript" excludes="CVS/**"
prefix="javascript"/>
<zipfileset dir="style" excludes="CVS/**" prefix="style"/>
</war>
</target>
<target name="main" description="Default Target"
depends="init,clean, prep, compile, war"/>
</project>
</code>
Lim Hock-Chai wrote:
I created a project in eclipse that contains JSP, servlet, java classes and html. I've been manually creating the war file to deploy them to tomcat, quite a pain. I've heard that Ant is a better approach on doing this. Does anybody have an example of how Ant work?
--
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.