ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Using compiled classes later in build?
Date Mon, 30 Apr 2001 15:36:33 GMT

Anyone have any ideas on this?

Does anyone know if it is possible to have Ant display a directory list?  That
way I could see if the files have been compiled and are available to the JspC

Many thanks,


David Hay
04/27/2001 04:39 PM


Subject:  Re: Using compiled classes later in build?  (Document link: David Hay)

Hi Nico,

Yep, agree it should work!!  One thing I forgot to mention is that if I run Ant
twice (exactly the same file etc.) it only compiles some of the jsp's the first
time, but ALL of them the second!  The ones it doesn't compile first time are
those which have custom tag, which reference the classes build in the previous
target.  If I compile these original  classes and put them in a seperate
location, and point to them rather than the classes Ant has just compiled, it
works fine first time.

My classpaths are all set in env.bat which I execute before Ant.  Please find
buildAll.xml and env.bat below (still testing, so xml not been cleaned up yet!
I am executing compileJSPs target.)

So...if anyone can spot the problem, or explain the behaviour, I'd be very


<!--Build file for ServerWebPage project -->
<project name="My Project" default="compileJSPs" basedir=".">

  <property name=""       value="~MvServer"/>
  <property name="deploy.home"    value=".\classes\${}"/>
  <property name="build"            value=".\classes\build"/>
  <property name="dist.home"      value="${deploy.home}"/>
  <property name="dist.src"       value="${}.jar"/>
  <property name="dist.war"       value="${}.war"/>
  <property name="src"                    value=".\src"/>
  <property name="lib"                    value=".\lib"/>
  <property name="build.compiler" value="jikes"/>
  <property name="struts.home"      value="d:\jakarta-struts"/>

  <target name="prepare">
      <!-- html files -->
    <mkdir  dir="${deploy.home}"/>
      <!-- images -->
      <mkdir dir="${deploy.home}\images"/>
      <!-- WEB-INF dir: xml & tld files -->
    <mkdir  dir="${deploy.home}\WEB-INF"/>
      <!-- WEB-INF\classes: compiled class files -->
    <mkdir  dir="${deploy.home}\WEB-INF\classes"/>
      <!-- WEB-INF\classes: compiled class files - beans package -->
    <mkdir  dir="${deploy.home}\WEB-INF\classes\beans"/>
      <!-- WEB-INF\classes\JspServ: compiled .jsp files -->
    <mkdir  dir="${deploy.home}\WEB-INF\classes\JspServ"/>
    <!-- WEB-INF\lib: struts.jar etc. -->
      <mkdir  dir="${deploy.home}\WEB-INF\lib"/>

  <target name="clean">
    <delete dir="${deploy.home}"/>

  <target name="compile" depends="prepare">
      <!-- beans package -->
      <javac srcdir="${src}\beans" destdir="${deploy.home}\WEB-INF\classes"
           debug="on" optimize="off" deprecation="off"/>
    <copy   todir="${deploy.home}/WEB-INF/classes">
      <fileset dir="${src}\prop" includes="**/*.properties"/>

  <target name="copyFiles" depends="compile">
      <!-- html files -->
    <copy todir="${deploy.home}">
      <fileset dir="$src\html"/>
      <!-- images -->
      <copy todir="${deploy.home}\images">
          <fileset dir="${src}\images"/>
      <!-- WEB-INF dir: xml & tld files -->
      <copy todir="${deploy.home}\WEB-INF">
          <fileset dir="$src\jsp\WEB-INF"/>
    <!-- WEB-INF\lib: struts.jar etc. -->
    <copy todir="${deploy.home}\WEB-INF\lib">
      <fileset dir="lib"/>

  <target name="jspc" depends="copyFiles">
      <java classname="org.apache.jasper.JspC">
      <arg value="-d" />
      <arg file="${deploy.home}\WEB-INF\classes\JspServ_preComp" />
          <arg value="-v4"/>
          <arg value="-p" />
          <arg value="JspServ" />
      <arg value="-webapp" />
      <arg file="${src}\jsp"/>

     <target name="compileJSPs" depends="jspc">
          <javac srcdir="${deploy.home}\WEB-INF\classes\JspServ_preComp\JspServ"

           debug="on" optimize="off" deprecation="off"/>

  <target name="all" depends="clean,prepare,compile"/>

  <target name="dist" depends="prepare,compile">
    <jar jarfile="${dist.home}\${dist.src}"
    <jar jarfile="${dist.home}\${dist.war}"


REM Setup the environment for building granite
if exist o:\nul if not exist o:\TOOLDRV.ID net use o: /delete
if not exist o:\nul net use o: \\\utilapps

REM Setup tools
set Path=o:\MSVC40\bin;%Path%

REM Setup up the latest JDK 1.3 compiler
set JDKHOME=O:\java\jdk\1.3
set CLASSPATH=%JDKHOME%\jre\lib\rt.jar;
set Path=%JDKHOME%\bin;%Path%

REM Setup the jikes compiler
set JIKESHOME=O:\java\ibm\jikes112
set Path=%JIKESHOME%\bin;%Path%

REM Setup Ant
set ANT_HOME=O:\java\ant1.2
set Path=%ANT_HOME%\bin;%Path%

REM Setup access to Granite classes

REM Setup access to Tomcat JSP compiler
set jsdkJars=%TOMCAT_DIR%\lib\common\servlet.jar;%STRUTS_DIR%\lib\struts.jar
set jspJars=%TOMCAT_DIR%\lib\container\jasper.jar
set beanJars=d:\dev\nato\ServerWebPage\classes\build\WEB-INF\classes
rem xml parser stuff, plus util.Log

set appJars=%jsdkJars%;%jspJars%;%beanJars%;%miscJars%
set sysJars=%JAVA_HOME%\lib\tools.jar

set appClassPath=%TOMCAT_DIR%\classes;%appJars%
set cp=%CLASSPATH%

set CLASSPATH=%CLASSPATH%;%appClassPath%;%sysJars%

"Nico Seessle" <> on 04/27/2001 02:56:46 PM

Please respond to

cc:    (bcc: David Hay/Lex/Lexmark)
Subject:  Re: Using compiled classes later in build?

----- Original Message -----
From: <>
To: <>
Sent: Friday, April 27, 2001 7:44 PM
Subject: Using compiled classes later in build?

> I am using Ant to build my web app.  After building all my classes, I try
> pre-compile my jsp's with JspC (Tomcat).  This is fine for some of the
> but those which have custom tags which were compiled in the previous step
> out with a size of 0!
> I believe the problem is something to do with using the compiled classes
> in the build, but I do not understand why this would be a problem.  I have

> It seems like there should be a way to do this in go!!

You are right, and normally it should work.

Can you give us more details of the steps in your build.xml or post the
relevant parts of your build.xml? Are you sure the classes you compile in
the first step are compiled to a location that is in the classpath of your


View raw message