Confirmed, that did it!  I was attempting to run the task straight from maven 
instead of handing it off to Ant for processing.  Apparently, that makes a 
difference!

Thanks Mark,
-D

> -----Original Message-----
> From: Mark Langley [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, November 09, 2004 2:04 PM
> To: Darren Hartford; 'Maven Users List'
> Subject: RE: Class Cast exception trying to use org.apache.jasper.JspC
> 
> 
> Here's the maven.xml fragment that we use. I'm afraid I can't help any
> further if this doesn't work - after several failed attempts 
> this is the
> approach that finally worked for us with Tomcat 5.0.28.
> 
> Mark Langley
> CaseBank Technologies Inc.
> http://www.casebank.com
> 
> <project
>   default="build-all"
>   xmlns:maven="jelly:maven"
>   xmlns:j="jelly:core"
>   xmlns:u="jelly:util"
>   xmlns:ant="jelly:ant"
>  
> xmlns:velocity="jelly:org.apache.commons.jelly.tags.velocity.V
> elocityTagLibr
> ary"
>   xmlns:deploy="deploy">
> 
> ...
> 
> <!-- 
>   - The next three goals are used to pre-compile jsp pages 
> into servlets.
>   - This code is lifted from 
>   - http://wiki.codehaus.org/maven/CreatingWebApplications
>   -->
>   <preGoal name="war:webapp">
>     <j:set var="precompileJsp" value="${precompile.jsp}"/>
>     <j:if test="${precompileJsp == 'true'}">
>        <echo message="Precompiling JSPs. Set precompile.jsp=false in
> build.properties if you're impatient!"/>
>        <attainGoal name="precompile-jsp"/>
>     </j:if>
>     <j:if test="${precompileJsp == 'false'}">
>        <echo message="JSPs are NOT being precompiled! Is this 
> a production
> build???"/>
>     </j:if>
>   </preGoal>
> 
>   <postGoal name="war:webapp">
>     <j:set var="precompileJsp" value="${precompile.jsp}"/>
>     <j:if test="${precompileJsp == 'true'}">
>       <j:set var="target"
> value="${pom.getPluginContext('maven-war-plugin').getVariable(
> 'maven.war.web
> app.dir')}"/>
>       <u:available file="${maven.build.dir}/web-fragment.xml">
>         <u:loadText var="fragment"
> file="${maven.build.dir}/web-fragment.xml"/>
>         <ant:replace file="${target}/WEB-INF/web.xml" 
> token="&lt;!-- [INSERT
> FRAGMENT HERE] --&gt;" value="${fragment}"/>
>       </u:available>
>     </j:if>
>   </postGoal>
> 
>   <goal name="precompile-jsp" description="Precompile all 
> JSPs into java
> classes, and then into classes" prereqs="war:load,java:compile">
>     <j:set var="warSource"
> value="${pom.getPluginContext('maven-war-plugin').getVariable(
> 'maven.war.src
> ')}"/>
>     <ant:mkdir dir="${maven.build.dir}/jspc"/>
>     <ant:mkdir dir="${maven.build.dir}/jspc-processed"/>
>     <ant:mkdir dir="${maven.build.dir}/jspc-classes"/>
> 
>     <j:set var="jspOutDir" value="${maven.build.dir}/jspc"/>
>     <j:set var="jspClassesOutDir" value="${maven.build.dest}"/>
>     <ant:path id="jspc.classpath">
>       <ant:fileset dir="${java.home}/../lib">
>         <include name="tools.jar"/>
>       </ant:fileset>
>       <ant:fileset dir="${tomcat.home}/bin/">
>         <include name="*.jar"/>
>       </ant:fileset>
>       <ant:fileset dir="${tomcat.home}/server/lib">
>         <include name="*.jar"/>
>       </ant:fileset>
>       <ant:fileset dir="${tomcat.home}/common/lib">
>         <include name="*.jar"/>
>       </ant:fileset>
>       <ant:path refid="maven.dependency.classpath"/>
>       <ant:pathelement path="${maven.build.dest}"/>
>     </ant:path>
>     <ant:taskdef name="jasper2" classname="org.apache.jasper.JspC"
> classpathref="jspc.classpath"/>
> 
>     <ant:java 
>       taskname="jspc"
>       className="org.apache.jasper.JspC"
>       failonerror="true"
>       fork="yes">
>       <ant:classpath refid="jspc.classpath"/>
> <!--      <ant:arg value="-help"/> -->
> 
>       <ant:arg value="-webapp"/>    <ant:arg value="${warSource}"/>
>       <ant:arg value="-d"/>         <ant:arg value="${jspOutDir}"/>
>       <ant:arg value="-l"/>
>       <ant:arg value="-p"/>         <ant:arg
> value="your.package.path.here"/>
>       <ant:arg value="-die"/>
>       <ant:arg value="-uribase"/>   <ant:arg value="${warSource}"/>
>       <ant:arg value="-uriroot"/>   <ant:arg value="${warSource}"/>
>       <ant:arg value="-webinc"/>    <ant:arg
> value="${maven.build.dir}/web-fragment.xml"/>
>       <ant:arg value="-trimSpaces"/> 
>     </ant:java>
>     
>     <ant:javac
>       srcdir="${jspOutDir}"
>       destdir="${jspClassesOutDir}"
>       debug="${maven.compile.debug}"
>       deprecation="${maven.compile.deprecation}"
>       optimize="${maven.compile.optimize}"
>       classpathref="jspc.classpath"/>
> 
>   </goal>
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to