We are using jspc ant task to pre-compile JSP files into classes/(then package into war)
Now we are switching to Jetty 8. According to the doc, there exists a maven plugin to do this. Do we have ant task to do the same?
We are using jspc ant task to pre-compile JSP files into classes/(then package into war)
Now we are switching to Jetty 8. According to the doc, there exists a maven plugin to do this. Do we have ant task to do the same?
Its best if you use the JSP libs that comes with the jetty distribution.
Here's an example, using jetty-distribution-8.1.5.v20120716
<?xml version="1.0" ?>
<project name="AntExample1" default="war">
<property name="jetty.home" value="${user.home}/code/intalio/distros/jetty-distribution-8.1.5.v20120716" />
<path id="compile.jspc">
<fileset dir="${jetty.home}">
<include name="lib/servlet-api-*.jar" />
<include name="lib/jsp/*.jar" />
</fileset>
</path>
<path id="compile.classpath">
<fileset dir="WebContent/WEB-INF/lib">
<include name="*.jar" />
</fileset>
<path refid="compile.jspc" />
</path>
<target name="jspc" depends="compile">
<taskdef classname="org.apache.jasper.JspC" name="jasper2" classpathref="compile.jspc" />
<jasper2 validateXml="false"
uriroot="WebContent"
addWebXmlMappings="true"
webXmlFragment="WebContent/WEB-INF/generated_web.xml"
compilerSourceVM="1.6"
compilerTargetVM="1.6"
outputDir="build/gen-src"
verbose="9" />
</target>
<target name="init">
<mkdir dir="build/classes" />
<mkdir dir="build/gen-src" />
<mkdir dir="dist" />
<copy todir="build/gen-src">
<fileset dir="src" includes="**/*.java" />
</copy>
</target>
<target name="compile" depends="init">
<javac destdir="build/classes" debug="true" srcdir="build/gen-src">
<classpath refid="compile.classpath" />
</javac>
</target>
<target name="war" depends="jspc">
<war destfile="dist/AntExample.war" webxml="WebContent/WEB-INF/web.xml">
<fileset dir="WebContent" />
<classes dir="build/classes" />
</war>
</target>
<target name="clean">
<delete dir="dist" />
<delete dir="build" />
</target>
</project>
Update: April 8, 2013
Pushed an example project with this build to github.
https://github.com/jetty-project/jetty-example-jspc-ant
Jasper has jspc; the linked page has ant code for calling it.
From your first sentence you are apparently already using an ant task to pre-compile the jsp files...so using jetty-8 doesn't mean you have to change that process at all, you will still just pre-compile as you have been, building your war file as you have been and then just deploy into jetty-8. You will need to add jsp to the OPTIONS in the start.ini to get the jsp engine into the server classloader.