Dear all,
I'm new to the maven. When I doing JSP precompilation process in
maven.xml the following scripts I have used. But I get the error class
cast exception .
How to solve this problem. can any one help me.? Thanks.
<goal name="precompile-jsp" description="Precompile all JSPs into java
classes, and then into classes" prereqs="java:compile">
<maven:set value="warSource" property="${maven.war.src}"
plugin="maven-war-plugin" />
<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:pathelement
location="${maven.tomcat.home}/common/lib/jasper-runtime.jar"/>
<ant:pathelement
location="${maven.tomcat.home}/common/lib/jasper-compiler.jar"/>
<ant:pathelement
location="${maven.tomcat.home}/common/lib/servlet.jar"/>
<ant:pathelement
location="${maven.tomcat.home}/common/lib/servlet-api.jar"/>
<ant:pathelement
location="${maven.tomcat.home}/common/lib/jsp-api.jar"/>
<ant:path refid="maven.dependency.classpath"/>
<ant:pathelement path="${maven.build.dest}"/>
</ant:path>
<ant:taskdef classname="org.apache.jasper.JspC" name="jasper2" >
<ant:classpath>
<ant:pathelement
location="${maven.java.home}/../lib/tools.jar"/>
<ant:fileset dir="${ENV.CATALINA_HOME}/server/lib">
<vinclude name="*.jar"/>
</ant:fileset>
<ant:fileset dir="${ENV.CATALINA_HOME}/common/lib">
<ant:include name="*.jar"/>
</ant:fileset>
<ant:path refid="jspc.classpath"/>
</ant:classpath>
</ant:taskdef>
<ant:jasper2 verbose="0"
package="my.package"
uriroot="${maven.webapp.path}/${maven.webapp.name}"
webXmlFragment="${maven.build.dir}/generated_web.xml"
outputDir="${maven.webapp.path}/${maven.webapp.name}/WEB-INF/src/my/pack
age" />
<!-- <ant:jasper2
webXmlFragment="${maven.build.dir}/web-fragment.xml"
package="${pom.package}.jsp.${pom.artifactId}"
outputDir="${jspOutDir}"
srcdir="${warSource}"
uriroot="${warSource}"
uribase="${pom.artifactId}"
verbose="2">
</ant:jasper2>
<ant:jasper2
package="${pom.package}.jsp"
destDir="${maven.war.src}"
uriroot="${maven.war.src}"
srcdir="${maven.war.src}"
classpathref="jspc.classpath">
<ant:include name="**/*.jsp"/>
<ant:exclude name="**/includes/**/*.jsp"/>
</ant:jasper2>
-->
<ant:javac
srcdir="${jspOutDir}"
destdir="${jspClassesOutDir}"
debug="${maven.compile.debug}"
deprecation="${maven.compile.deprecation}"
optimize="${maven.compile.optimize}"
classpathref="jspc.classpath">
</ant:javac>
</goal>
When I executing the above script I'm getting the class cast exception.
precompile-jsp:
[mkdir] Created dir: D:\Maven1.0.2\bin\target\jspc
[mkdir] Created dir: D:\Maven1.0.2\bin\target\jspc-processed
[mkdir] Created dir: D:\Maven1.0.2\bin\target\jspc-classes
[jasper2] [ERROR] Error in class org.apache.jasper.JspC
BUILD FAILED
File...... D:\Maven1.0.2\bin\maven.xml
Element... ant:jasper2
Line...... 96
Column.... 91
java.lang.ClassCastException
Total time: 3 seconds
Finished at: Thu Aug 11 18:58:25 GMT+05:30 2005
If anyone knows pls reply.
Confidentiality Statement:
This message is intended only for the individual or entity to which it is
addressed. It may contain privileged, confidential information which is exempt
from disclosure under applicable laws. If you are not the intended recipient,
please note that you are strictly prohibited from disseminating or distributing
this information (other than to the intended recipient) or copying this
information. If you have received this communication in error, please notify us
immediately by return email.