Ack, jspf files don't precompile! Please help!
shinysteelrobot Mar 15, 2004 9:23 PMJSP fragment files (*.jspf) don't seem to be precompilable. I've set up a "precompile" target in my Ant build script. It invokes jspc which works fine for .jsp files. The .jsp files get compiled, war'red, and run within JBoss 3.0.8. However, the jspf files DO NOT get compiled by the jspc task. This is a big problem as a lot of my code is in jspf files.
The weird thing is that the jspf and jsp files both work fine when accessed/compiled within a running version JBoss. So somehow JBoss is able to compile jspf files with no problem. Why doesn't it work for jspc?
I'm attaching my "precompile" ant target below in case anyone spots an obvious error in it (I couldn't get the Ant variable dollarsign-curly brace stuff to show up correctly though, so all the variable assignments look like empty strings, "").
Many thanks for any help!
- Justin
<target name="precompile" depends="init" description="Precompile JSPs in WAR"> <echo message="Started JSP precompilation"/> <echo message="set precompilation properties"/> <property name="jasper.jar" value="/server/default/deploy/jbossweb.sar/org.apache.jasper.jar"/> <property name="servlet.jar" value="/server/default/deploy/jbossweb.sar/org.mortbay.jetty.jar"/> <property name="jsp.precomp.unwarred_pweb_tmpdir" value="/pweb2_unwar"/> <property name="jsp.precomp.generated_java_tmpdir" value="/generated_java"/> <property name="jsp.precomp.generated_servlets_xml_file" value="/WEB-INF/jsp-servlets.xml"/> <echo message="set precompilation classpath"/> <path id="jsp.precomp.classpath"> <pathelement location=""/> <pathelement location=""/> <pathelement location="/j2ee.jar"/> <pathelement location="/crimson.jar"/> <pathelement location="/log4j.jar"/> <pathelement location="/wm-jam-common.jar"/> </path> <echo message="delete and re-create precompilation directories"/> <delete dir=""/> <delete dir=""/> <mkdir dir=""/> <echo message="unwar WAR file from src () to dest ()"/> <unwar src="" dest=""/> <echo message="translate JSP files to Java source code"/> <jspc failonerror="false" srcdir="" destdir="" verbose="3" compiler="jasper41" webinc=""> <classpath> <pathelement location="/WEB-INF/classes"/> <fileset dir="/WEB-INF/lib"><include name="*.jar"/></fileset> <path refid="jsp.precomp.classpath"/> </classpath> </jspc> <echo message="precompile the translated JSP-Java files to class binaries"/> <javac srcdir="" destdir="/WEB-INF/classes" optimize="" debug="" depend="" verbose="" deprecation="" includeAntRuntime="" includeJavaRuntime="" failonerror="false"> <classpath> <pathelement location="/WEB-INF/classes"/> <fileset dir="/WEB-INF/lib"><include name="*.jar"/></fileset> <path refid="jsp.precomp.classpath"/> </classpath> <include name="**/*.java"/> </javac> <echo message="merge newly compiled JSP-Java servlet directives into web.xml"/> <loadfile property="directives" srcFile=""/> <replace file="/WEB-INF/web.xml" value="" token="<!-- precompilation merge-point -->"/> <!-- <echo message="removing JSPs from webapp since they are now compiled servlets"/> <delete> <fileset dir=""> <include name="**/*.jsp"/> </fileset> </delete> --> <echo message="re-war tmp webapp dir from src () to dest ()"/> <jar destfile="/pweb.war" basedir=""/> <!-- tidy up working directories <delete dir=""/> <delete dir=""/> not yet!--> <echo message="Finished JSP precompilation"/> </target>