ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Raible" <m...@raibledesigns.com>
Subject Ant's jspc task - doesn't work on Tomcat 4.1.18
Date Sun, 22 Dec 2002 07:16:16 GMT

I'm trying to use Ant's JSPC task to pre-compile my JSPs. I've used Erik
Hatcher's example from Java Development with Ant. It works great when
using a 4.0.x version of Tomcat, and the following jasper.classpath: 

<path id="jasper.classpath">
    <fileset dir="${tomcat.home}/lib">
        <include name="jasper-*.jar"/>
    </fileset>
    <fileset dir="${tomcat.home}/common/lib">
        <include name="servlet.jar"/>
    </fileset>
</path>

However, it doesn't work on Tomcat 4.1.17. I had to change the
jasper.classpath to find the appropriate jars (they're in different
directories now), plus I had to include ant.jar or I got
java.lang.NoClassDefFoundError: org/apache/tools/ant/AntClassLoader.
Where everything works on the older Tomcat version, now it fails - what
gives? 

compile-jsp:
     [jspc] Compiling 8 source filesD:\source\appfuse\build\jspc\java
  [jasperc] 2002-12-21 11:15:51 - uriRoot implicitly set to 
            "D:\Tools\tomcat-4.1.17\webapps\appfuse"
  [jasperc] error:/common/footer.jsp(0,0) null
  [jasperc] 2002-12-21 11:15:53 - ERROR-the file '\common\footer.jsp' 
            generated the following general exception:
org.apache.jasper.JasperException: 
            /common/footer.jsp(0,0) null

Also, what's the best way to detect if the user has Tomcat 4.0 vs. 4.1?

Thanks,

Matt


<!-- ===================================================================
-->
<!--            Compile JSPs using jspc
-->
<!-- ===================================================================
-->
<property name="build.jspc.java.dir"
    location="${build.dir}/jspc/java" />
    
<property name="build.jspc.classes.dir"
    location="${build.dir}/jspc/classes" />
    
<property name="war.expanded.dir"
    location="${tomcat.home}/webapps/${webapp.name}" />
    
<path id="jasper.classpath">
    <!-- Tomcat 4.0.x -->

    <fileset dir="${tomcat.home}/lib">
        <include name="jasper-*.jar"/>
    </fileset>
    <fileset dir="${tomcat.home}/common/lib">
        <include name="servlet.jar"/>
    </fileset>

    <!-- Tomcat 4.1.x -->
    <!---->
    <fileset dir="${tomcat.home}/common/lib">
        <include name="ant.jar"/>
        <include name="servlet.jar"/>
        <include name="jasper-*.jar"/>
    </fileset>
    -->
</path>

<target name="compile-jsp" depends="deploy-web">
    <mkdir dir="${build.jspc.classes.dir}" />
    <mkdir dir="${build.jspc.java.dir}" />
    
    <!-- create the .java files -->
    <jspc srcdir="${war.expanded.dir}" verbose="6"
        destdir="${build.jspc.java.dir}">
        <include name="*/**.jsp"/>
        <classpath refid="jasper.classpath" />
    </jspc>
    
    <!-- compile the .java files -->
    <javac debug="${compile.debug}"
        srcdir="${build.jspc.java.dir}"
        destdir="${build.jspc.classes.dir}">
        <classpath>
            <path 
                location="${war.expanded.dir}/WEB-INF/classes" />
            <fileset dir="${war.expanded.dir}/WEB-INF/lib">
                <include name="**/*.jar"/>
            </fileset>
            <path refid="jasper.classpath"/>
        </classpath>
    </javac>
</target>



--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message