ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gert Driesen" <>
Subject Re: cvs commit: jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/optional
Date Tue, 12 Mar 2002 21:08:08 GMT
Hi Steve,

I looked at the javac implementation and I definitely can see how this could
work, but I don't know if this is how it should work.

Should users actually have to specify the commandline options themselves (as
javac task does with compiler arguments) ?

The weblogic jsp compiler has the following commandline options :

  Add a list (separated by semi-colons on Windows NT/2000 platforms or
colons on UNIX platforms) of directories that make up the desired CLASSPATH.
Include directories containing any classes required by the JSP. For example
(to be entered on one line):

$ java weblogic.jspc    -classpath java/;/weblogic/

  Specifies mapping of IANA or unofficial charset names used in JSP
contentType directives to java charset names. For example:
  -charsetMap x-sjis=Shift_JIS,x-big5=Big5
  The most common mappings are built into jspc. Use this option only if a
desired charset mapping is not recognized.

  Causes the JSP compiler to include comments from the JSP in the generated
HTML page. If this option is omitted, comments do not appear in the
generated HTML page.

  Recursively compiles all JSPs in the current directory, or in the
directory specified with the -webapp flag. (See the listing for -webapp in
this list of options.). JSPs in subdirectories are also compiled.

  Passes one or more command-line flags to the compiler. Enclose multiple
flags in quotes, separated by a space. For example:
  java weblogic.jspc -compileFlags "-g -v" myFile.jsp

  Specifies the Java compiler to be used to compile the class file from the
generated Java source code. The default compiler used is javac. The Java
compiler program should be in your PATH unless you specify the absolute path
to the compiler explicitly.

  Runs a Java compiler as a Java class and not as a native executable.

  -d <dir>
  Specifies the destination of the compiled output (that is, the class
file). Use this option as a shortcut for placing the compiled classes in a
directory that is already in your CLASSPATH.

  If a previously generated class file for a JSP has a more recent date
stamp than the JSP source file, the JSP is not recompiled.

  Compile with debugging on.

  Warn about the use of deprecated methods in the generated Java source file
when compiling the source file into a class file.

  -docroot directory
  See -webapp.

  -encoding default|named character encoding
  Valid arguments include (a) default which specifices using the default
character encoding of your JDK, (b) a named character encoding, such as
8859_1. If the -encoding flag is not specified, an array of bytes is used.

  Instructs the Java compiler to include debugging information in the class

  Displays a list of all the available flags for the JSP compiler.

  Takes a list of options that are passed to your compiler.

  When compiling multiple JSPs with with a single command, the compiler
continues compiling even if one or more of the JSPs failed to compile.

  Keeps the Java source code files that are created as an intermediary step
in the compilation process. Normally these files are deleted after

  If a JSP file has numerous or deeply nested custom JSP tags and you
receive a java.lang.VerifyError exception when compiling, use this flag to
allow the JSPs to compile correctly.

  Turns off warning messages from the Java compiler.

  Runs the compilation process without actually producing a .class file. If
you combine this option with the -keepgenerated flag, the compiler creates
only the intermediate .java file, which can be useful for debugging.

  Compiles the generated Java source file with optimization turned on. This
option overrides the -g flag.

  -package packageName
  Sets the package name that is prepended to the package name of the
generated Java HTTP servlet. Defaults to jsp_servlet.

  -superclass classname
  Sets the classname of the superclass extended by the generated servlet.
The named superclass must be a derivative of HttpServlet or GenericServlet.

  Passes the verbose flag to the Java compiler specified with the compiler
flag. See the compiler documentation for more information. The default is

  Prints messages generated by the designated JSP compiler.

  Prints the version of the JSP compiler.

  -webapp directory
  Name of a directory containing a Web Application in exploded directory
format. If your JSP contains references to resources in a Web Application
such as a JSP tag library or other Java classes, the JSP compiler will look
for those resources in this directory. If you omit this flag when compiling
a JSP that requires resources from a Web Application, the compilation will

I think we should support the following weblogic compiler options :

    -classpath <classpath>
    -d <destination directory>
    -package <packagename>
    -webapp <direcory of webapplication>

    As you can see the weblogic jsp compiler has some switches that are
equal to those for the Jasper jsp compiler :




    and some switches have other names but have the same meaning :

    -verbose        I guess is the same as specifying -v1 a option to the
jasper jsp compiler, but in weblogic you can't specify a level of verbosity

    - package      Is the same as the -p option of the jasper jsp compiler

and the other switches do not exist in the jasper jsp compiler, but these
are the options I think are usefull :

  If you specify the -depend switch, then the WebLogic jsp compiler itself
will detect which jsp pages have to be recompiled, so it's no need to check
this ourselves for the weblogic jsp compiler.

  Perhaps for the WebLogic jsp compiler we should use this compiler option
instead of having to do a check on the last modified time of the java files
ourselves, this would also solve one issue for us and that is the different
jsp filename to java source filename mapping for Jasper and Weblogic.  By
using this option we wouldn't have to use jsp filename to java source
filename mapping for the weblogic compiler at all.

  The one issue with this is that the -depend switch compares the timestamp
of the jsp file with the timestamp of the .class file, not the .java file
-keepgenerated and -nowrite
  These should always be specified (the user shouldn't be able to specify
these options), because these options will make sure WebLogic saves the
generated java sources to disk and does not compile the generated java
  This would keep it functionally the same as the Jasper jsp compiler,
because I don't think Jasper allows you to immediately compile the generated
java sources.
  This user of the task should be able to specify an attribute (which maps
to this commandline option) for large jsps.  Apparently, there's no similar
option for Jasper .. I ran into this problem myself recently : I have one
jsp page that I can't get to compile using Jasper because the java source
that's generated by the Jasper compiler is too large (method length is >
65Kb) ...
  Should be set by code if failonerror is false, this will make sure the
weblogic jsp compiler does not stop compiling if one or more jsps fail to

I think the JspC task should support the following attributes, which are
usefull for all (?) jsp compilers :

  already available
  already available, but is current an int value, would be better to make it
a boolean value
  boolean value to indicate that all jsp pages should be rebuild, so :
    for the Jasper compiler : don't perform a check on the last modified
time, just pass all jsp pages to the compiler

    for the weblogic compiler : don't add the -depend commandline argument
  already available
      why didn't you just use a simple attribute (eg. webAppDir) for this in
the current implementation ?
  already available
  already available

That leaves use with the following attributes which are specific to the
jasper compiler :


and the following attributes which are specific to the weblogic compiler :


(and perhaps encoding)

Can you please comment on (all of) this ?

now with regards to your last message :

- I don't really understand what you mean with the dir naming issue ... can
you please elaborate on that ?

- I also don't understand why you would make uriroot mandatory, but I guess
you'll explain further :-)

Happy reading :-)

Gert Driesen

> ----- Original Message -----
> From: "Gert Driesen" <>
> To: "Ant Developers List" <>
> Sent: Monday, March 11, 2002 11:09 AM
> Subject: Re: cvs commit:
> jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/optional
> > I don't yet see how the current implementation of the JspC task will
> support
> > other jsp compilers :
> we'll deal with that when we come to it. If you have a particular back end
> in mind, lets get started on it.
> > - other compilers accept or even require other/more commandline options
> cut and paste from <javac>
> > - other compiler have other rules for mapping jsp files to java files
> > example, the weblogic jsp compiler will also convert the filename of the
> jsp
> > to lowercase, although it can be controlled by a option, and will insert
> '_'
> > at the start of the filename, so the jsp file 'SearchFile.jsp' will map
> > '')
> I am aware of that fact; the JRun back end is the example. I have not yet
> committed some changes which move this to the compiler...whateever
> you have is the source of a mangler.
> One thing I am unsure about is how to to do dir naming? Should that be the
> responsibility of javac or do implementations want to override?
> It may actually be simplest to have the back end implementation take the
> patterns and sort it out themselves (the default implementation will be
> workable)
> Also, I am minding towards making uriroot a requirement so we can handle
> subdirectories better, and report a better error mesage when you try to
> compile a file out of the tree (all you get now is an empty stack
> Seem reasonable.
> --
> To unsubscribe, e-mail:   <>
> For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message