You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Theen-Theen Tan <tc...@marimba.com> on 2004/07/31 01:03:54 UTC

JSPC to precompile failonerror

 
Hi,
 
I am trying to precompile JSP in my Ant build process.  Not all the JSP files precompile because they use dynamic <jsp:include> include.  I would like the Ant build to continue even if there's errors during the precompile.  Even using failonerror="false", files with compilation errors will be compiled, but finally, I still get the error from the If task as indicated below.
 
Thanks!
 
Theen-Theen
 
 
  <target name="compile-jsp">
    <property name="jsp.package" value="org.apache.jsp"/>
 
    <create-moduleset listid="jsp.jar.files" type="3rdparty" modules="ant,jasper-runtime,jasper-compiler"/>
    <path id="jsp.jar.path">
      <fileset refid="jsp.jar.files"/>
    </path>
    <mkdir dir="${build-common}/tmp/interim-jsp"/>
    <mkdir dir="${build-common}/tmp/dependencies"/>
    <mkdir dir="${web.dir}/WEB-INF/jsp-classes"/>
    <!-- Build application JSP-files -->
    <if>
      <available file="resources/channel/webapp"/>
      <then>
        <jspc srcdir="resources/channel/webapp"
              destdir="${build-common}/tmp/interim-jsp"
              uriroot="resources/channel/webapp"
              package="${jsp.package}"
              compiler="jasper41"
              verbose="1"
              failonerror="false"
       >
          <classpath>
            <path refid="main.classpath"/>
            <path refid="jsp.jar.path"/>
            <pathelement path="${build-common}/classes"/>
          </classpath>
        </jspc>
 
        <depend srcdir="${build-common}/tmp/interim-jsp"
                destdir="${web.dir}/WEB-INF/jsp-classes"
                cache="${build-common}/tmp/dependencies">
          <classpath>
            <path refid="main.classpath"/>
            <path refid="jsp.jar.path"/>
            <pathelement path="${build-common}/classes"/>
          </classpath>
        </depend>
 
        <javac srcdir="${build-common}/tmp/interim-jsp" destdir="${web.dir}/WEB-INF/jsp-classes">
          <classpath>
            <path refid="main.classpath"/>
            <path refid="jsp.jar.path"/>
            <path refid="web-common.jar.path"/>
            <pathelement path="${build-common}/classes"/>
          </classpath>
        </javac>
 
        <propertyfile file="${channel.dir}/properties.txt">
          <entry key="webapp.jsp.compiled" value="true"/>
        </propertyfile>
     </if>
  </target>
 
=================================================================
 
Error
 
  [javac] 26 errors
 
       [if] Error in class net.sf.antcontrib.logic.IfTask
 
BUILD FAILED
 
C:\Workspaces\p4\depot\ws\shared\build\main\shared-web.xml:176: Compile failed;
see the compiler error output for details.
        at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:944)
        at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:764)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:65)
        at net.sf.antcontrib.logic.IfTask.execute(Unknown Source)
        at java.lang.reflect.Method.invoke(Native Method)
        at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:124)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:301)
        at org.apache.tools.ant.Target.performTasks(Target.java:328)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
        at org.apache.tools.ant.Main.runBuild(Main.java:632)
        at org.apache.tools.ant.Main.startAnt(Main.java:183)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)