In my Ant build.xml file, I am trying to compile JSPs using ojspc. The files are being compiled, however, the build process is still running to completion when the JSP compilation has errors.
This is part of my build.xml:
<java fork="true" jar="${env.ORACLE_HOME}\j2ee\home\ojspc.jar" resultproperty="result">
<jvmarg value="-Djava.compiler=NONE"/>
<arg value="-extend"/>
<arg value="com.orionserver.http.OrionHttpJspPage"/>
<arg value="-batchMask"/>
<arg value="*.jsp"/>
<arg value="${target-directory}/build/target/ear/${module-dir-name}-jsp.war"/>
</java>
<echo level="info">Result Property: ${result}</echo>
I have tried setting the property failonerror="true" but that does not change anything.
I receive the following output:
[java] Detected archive, now processing contents of ../build/target/ear/web-module-jsp.war...
[java] Setting up temp area...
[java] Expanding archive in temp area...
[java] C:\DOCUME~1\MMCCOR~1\LOCALS~1\Temp\tmp12940\_web_2d_inf\_jsp\_password.java:60: cannot resolve symbol
[java] symbol : variable reqvst
[java] location: class _web_2d_inf._jsp._password
[java] out.print(reqvst.getAttribute("test"));
[java] ^
[java] 1 error
[java] Creating D:\eclipse-workspace\jdw\build\..\build\target\ear\web-module-jsp.war ...
[java] Removing temp area...
[echo] Result Property: 0
...(more commands)
BUILD SUCCESSFUL
In the password.jsp file, I intentionally introduced an error to test.
How can I get the build to fail on an error?
At the Ant Java page, I am confused by:
By default the return code of a
is ignored. Alternatively, you can set
resultproperty to the name of a
property and have it assigned to the
result code (barring immutability, of
course). When you set
failonerror="true", the only possible
value for resultproperty is 0. Any
non-zero response is treated as an
error and would mean the build exits.