Bug 25345

Summary: jspc tag broken with new version of jasper
Product: Ant Reporter: John Swapceinski <jswap>
Component: Optional TasksAssignee: Ant Notifications List <notifications>
Severity: normal CC: josevnz, notifications, rickkw, serg_main, shankarunni
Priority: P3    
Version: 1.5.4   
Target Milestone: 1.6.2   
Hardware: Other   
OS: other   

Description John Swapceinski 2003-12-08 23:18:18 UTC
The jspc tag no longer works with the version of jasper that comes bundled with 
tomcat v5.0.16 (as opposed to tomcat v4.1.29, which works).  The problem is 
that this newer version of jasper has changed the "verbose" command-line option 
so it no longer accepts an optional number.  Because the jspc tag passes in a 
zero as the default value for the verbose param, the jspc action fails with the 
following error:
error:org.apache.jasper.JasperException: Unrecognized option: -v0

A quick fix would be to remove the default of zero.
Comment 1 josevnz 2004-01-18 14:18:55 UTC
I got the same problem when using it with Sun jwsdp-1.3, Sun Java (build
1.4.2-b28 and ant 1.5:

[xmlvalidate] 1 file(s) have been successfully validated.

     [jspc] Compiling 2 source files/home/josevnz/sourceforge/cvebrowser/test/jsp
  [jasperc] error:org.apache.jasper.JasperException: Unrecognized option: -v0. 
Use -help for help.
  [jasperc]     at org.apache.jasper.JspC.setArgs(JspC.java:306)
  [jasperc]     at org.apache.jasper.JspC.main(JspC.java:230)

My jspc task:

  <target name="compile-jsp" description="Precompiles the JSP pages in order to
catch errors early, before deploying the XXXX web app." depends="validate-xml">
  	<jspc srcdir="${web}" destdir="${test}/jsp" classpath="${path.classpath}"
		<exclude name="**/CVS"/>
		<include name="**/*.jsp" />

Comment 2 Steve Loughran 2004-01-19 13:33:18 UTC
Filed a bugrep w/ tomcat pointing out the regression, we can fix this in
ant1.6.1 but can do nothing for versions out there already (for obvious
reasons). A fix in Japser would be preferable.
Comment 3 josevnz 2004-01-19 18:56:06 UTC
When you guys plan to make the patch available? replacing ant with an improved
version is not that bad anyways :).
Comment 4 Steve Loughran 2004-01-20 09:54:51 UTC
Well, I filed a bugrep w/ tomcat and they said, roughly, 'stop it'.

Tomcat 5.x apparently comes with its own <jspc> task, that is tightly coupled to
tomcat, supported, may do better dependency checking, etc. etc. This is good as
trying to track changes in tomcat in the Jspc task was very painful.

So if you want to use the 5.x codebase, I would try using the jspc task that
comes with it. I havent had a play with it myself, but will now. 

1.6.1 will be coming out shortly, btw
Comment 5 Steve Loughran 2004-01-21 15:58:17 UTC
The Tomcat team have added back the -v setter, so future versions may work. I
say may as there are other changes that can break things.

Therefore I intend to document that the Ant-supplied version of <jspc> is only
for the 4.x version of tomcat; for later versions you should use Tomcat's own
task. This will make life a lot simpler.
Comment 6 Shankar Unni 2004-02-04 22:45:38 UTC
> for later versions you should use Tomcat's own task.

Except that the Tomcat 5 JspC, when invoked as an Ant task, does not support
filesets for an explicit list of files to compile. It only supports compiling an
entire directory.

You *have* to invoke it with <java fork="true" .../> to compile files
selectively, which is a big step back..
Comment 7 Steve Loughran 2004-02-05 09:42:58 UTC
That is something to take up with the Tomcat team; it should not be too hard to
add it to their task. 

The problem is, there is too high a rate-of-change in the tomcat Jasperc
behaviour (JSP->java file mapping, command options, error codes) and so many
other side issues that it is best if the compiler task lives with that team
-that ensures it is always in sync with the relevant release of the compiler. As
they release point releases much more frequently than ant does, this is important.

I might have a look at their task to see what can be done to take the best bits
from our tasks.
Comment 8 Nathan Christiansen 2004-03-16 20:14:45 UTC
*** Bug 27441 has been marked as a duplicate of this bug. ***
Comment 9 Stefan Bodewig 2004-06-28 08:21:49 UTC
*** Bug 27923 has been marked as a duplicate of this bug. ***
Comment 10 Stefan Bodewig 2004-06-28 08:24:03 UTC
Here is my plan:

* I'll look into detecting Tomcat 5.x and disable -v0 - if I don't find an easy way
  to detect 5.x, I'll resort to an attribute that will disable -v0 completely.

* <jspc> for Jasper will get deprecated in favor of Tomcat's version.
Comment 11 Stefan Bodewig 2004-06-28 08:56:28 UTC
I've implemented a work-around.

If anybody of you could please try a hand-crafted version of Ant form CVS HEAD and
confirm that it works now (I don't really use the task, so I have no proper
means to check it), that would be great.

Alternatively you can grab http://cvs.apache.org/~bodewig/ant-nodeps.jar and use
this one (please keep a backup of your own ant-nodeps.jar around) - this may
introduce problems with other optional tasks, though.

I won't close this report until it is confirmed as fixed.
Comment 12 Stefan Bodewig 2004-09-30 13:22:38 UTC
I assume that it works in 1.6.2.