ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@lexmark.com
Subject Re: Using compiled classes later in build?
Date Fri, 27 Apr 2001 20:39:30 GMT


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
grateful!

Dave

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


  <property name="app.name"       value="~MvServer"/>
  <property name="deploy.home"    value=".\classes\${app.name}"/>
  <property name="build"            value=".\classes\build"/>
  <property name="dist.home"      value="${deploy.home}"/>
  <property name="dist.src"       value="${app.name}.jar"/>
  <property name="dist.war"       value="${app.name}.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>

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


  <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"/>
    </copy>
  </target>


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

  <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"/>
    </java>
  </target>

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

                 destdir="${deploy.home}\WEB-INF\classes"
           classpath="${deploy.home}/WEB-INF/classes"
           debug="on" optimize="off" deprecation="off"/>
     </target>


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


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


</project>



***env.bat
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: \\toolbox.mw.prtdev.lexmark.com\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 JAVA_HOME=%JDKHOME%
set Path=%ANT_HOME%\bin;%Path%

REM Setup access to Granite classes
set
CLASSPATH=%CLASSPATH%;d:\dev\nato\granite\Design\classes\debug\graniteclient.jar

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
miscJars=%TOMCAT_DIR%\lib\container\jaxp.jar;%TOMCAT_DIR%\lib\container\parser.jar;%TOMCAT_DIR%\lib\common\core_util.jar;

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" <nico%apache.org@interlock.lexmark.com> on 04/27/2001 02:56:46 PM

Please respond to ant-user%jakarta.apache.org@interlock.lexmark.com

To:   ant-user%jakarta.apache.org@interlock.lexmark.com
cc:    (bcc: David Hay/Lex/Lexmark)
Subject:  Re: Using compiled classes later in build?



----- Original Message -----
From: <dhay@lexmark.com>
To: <ant-user@jakarta.apache.org>
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
to
> pre-compile my jsp's with JspC (Tomcat).  This is fine for some of the
jsp's,
> but those which have custom tags which were compiled in the previous step
come
> out with a size of 0!
>
> I believe the problem is something to do with using the compiled classes
later
> in the build, but I do not understand why this would be a problem.  I have
moved

> 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
jspc-compilation?

Nico









Mime
View raw message