Mantis - Resin
Viewing Issue Advanced Details
97 minor always 04-12-05 00:00 01-11-08 16:00
sam  
ferg  
normal  
closed  
3.0.12 fixed  
none    
none 3.1.5  
0000097: Ant task for JspCompiler
RSN-88
(rep by D Becker)

After a number of google searches, I have been unable to figure out how to
nicely precompile JSP pages for Resin via Ant. I've found the JspCompiler
class, but that seems to be geared for one-off compiling. There's got to be
a better way.
Ant

Notes
(0000101)
carcher   
04-12-05 00:00   
With resin 2 our company used the -compile option of httpd.exe to compile a single JSP page and then built a little script to discover all of the JSP pages to be compiled using the 'find' command. However, resin 3 does not support the -compile flag.

I'm trying to build JSP compilation into our ant build but running up against a roadblock using JspCompiler. I have successfully compiled the JSP pages for our app which do not use taglibs, but any page with a taglib always fails with the following error:

Exception in thread "main" com.caucho.jsp.JspLineParseException: /searchTableView.jsp:18: Can't find taglib-location `/s
truts-bean'. The taglib-location must match a tag library either:
1) by pointing to a .tld directly, relative to the application's root directory
2) specified in the web.xml
3) defined in a jar's .tld in META-INF
4) defined in a .tld in WEB-INF
5) predefined by Resin
        at com.caucho.jsp.JspParser.error(JspParser.java:1952)
        at com.caucho.jsp.JspParser.processTaglib(JspParser.java:1618)
        at com.caucho.jsp.JspParser.processTaglibDirective(JspParser.java:1585)
        at com.caucho.jsp.JspParser.parseDirective(JspParser.java:1120)
        at com.caucho.jsp.JspParser.parseScriptlet(JspParser.java:1002)
        at com.caucho.jsp.JspParser.parseNode(JspParser.java:406)
        at com.caucho.jsp.JspParser.parseJsp(JspParser.java:320)
        at com.caucho.jsp.JspParser.parse(JspParser.java:244)
        at com.caucho.jsp.JspCompilerInstance.generate(JspCompilerInstance.java:444)
        at com.caucho.jsp.JspCompiler.compileJsp(JspCompiler.java:625)
        at com.caucho.jsp.JspCompiler.main(JspCompiler.java:574)


I'm not sure what's going on because WEB-INF/web.xml contains this:

  <taglib>
    <taglib-uri>/struts-bean</taglib-uri>
    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
  </taglib>


And the JSP contains this:

  <%@ taglib uri="/struts-bean" prefix="bean" %>


This page compiles fine when actually running under resin, but not when using the JspCompiler from the command line like so:

java -cp /usr/local/resin/lib/resin.jar:/usr/local/resin/lib/jsdk-24.jar:/usr/local/resin/lib/isorelax.
jar:/usr/local/resin/lib/jstl-11.jar:/usr/local/resin/lib/jta-101.jar:/usr/local/resin/lib/jmx-12.jar:./web/WEB-INF/lib
/nprise.jar:./web/WEB-INF/classes com.caucho.jsp.JspCompiler -conf ./compile-app.xml web/searchTableView.jsp


and my compile-app.xml looks like this:

<web-app xmlns="http://caucho.com/ns/resin"> [^]
  <java compiler="javac" args="-source 1.4 -g"/>
  <app-dir>/usr/local/build/di.main/webapp/web</app-dir>
</web-app>


The lack of JSP compilation as part of our build process is a major reduction in functionality from resin 2.x. An ant task would be quite nice, but at this point even getting command line JspCompiler to work would be enough.

(0000102)
mate   
04-12-05 00:00   
Precompilation with and works fine for me; I just send the application root as parameter to the JspCompiler. Also remember to use fork.

  <target name="jspcompile">
    <java classname="com.caucho.jsp.JspCompiler" fork="true" >
      <classpath>
        ...
      </classpath>
      <arg line="-app-dir ${webapp.root}" />
    </java>
  </target>
(0002642)
ferg   
01-11-08 16:00   
See http://wiki.caucho.com/Ant [^] for documentation