ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers JasperC.java
Date Mon, 28 Jun 2004 08:50:32 GMT
bodewig     2004/06/28 01:50:32

  Modified:    .        Tag: ANT_16_BRANCH TODO WHATSNEW
               docs/manual/OptionalTasks Tag: ANT_16_BRANCH jspc.html
               src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers
                        Tag: ANT_16_BRANCH JasperC.java
  Log:
  merge
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.3.2.25  +0 -2      ant/Attic/TODO
  
  Index: TODO
  ===================================================================
  RCS file: /home/cvs/ant/Attic/TODO,v
  retrieving revision 1.3.2.24
  retrieving revision 1.3.2.25
  diff -u -r1.3.2.24 -r1.3.2.25
  --- TODO	28 Jun 2004 07:47:05 -0000	1.3.2.24
  +++ TODO	28 Jun 2004 08:50:31 -0000	1.3.2.25
  @@ -5,8 +5,6 @@
   anybody else (assignments look like [Stefan]) to yourself - and please
   remove items from this list once they are complete.
   
  -* Fix or at least document support for tomcat 5.0 jsp
  -
   * AntClassLoader parent loader [Start thread, Peter]
   
   * delete - do not follow symlinks [Peter, may be dropped for 1.6.2]
  
  
  
  1.503.2.115 +5 -0      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.503.2.114
  retrieving revision 1.503.2.115
  diff -u -r1.503.2.114 -r1.503.2.115
  --- WHATSNEW	25 Jun 2004 13:50:16 -0000	1.503.2.114
  +++ WHATSNEW	28 Jun 2004 08:50:31 -0000	1.503.2.115
  @@ -232,6 +232,11 @@
   * <junitreport> now also works with Xalan XSLTC and/or JDK 1.5.
     Bugzilla Report 27541.
   
  +* <jspc> doesn't work properly with Tomcat 5.x.  We've implemented a
  +  work-around but don't intend to support future changes in Tomcat
  +  5.x.  Please use the jspc task that ships with Tomcat instead of
  +  Ant's.
  +
   Changes from Ant 1.6.0 to Ant 1.6.1
   =============================================
   
  
  
  
  No                   revision
  No                   revision
  1.16.2.3  +7 -0      ant/docs/manual/OptionalTasks/jspc.html
  
  Index: jspc.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/OptionalTasks/jspc.html,v
  retrieving revision 1.16.2.2
  retrieving revision 1.16.2.3
  diff -u -r1.16.2.2 -r1.16.2.3
  --- jspc.html	9 Feb 2004 22:12:11 -0000	1.16.2.2
  +++ jspc.html	28 Jun 2004 08:50:32 -0000	1.16.2.3
  @@ -12,6 +12,13 @@
   <h3>Description</h3>
   
   <p> Ant task to run the JSP compiler and turn JSP pages into Java source.
  +
  +<p><b>Deprecated</b> if you use this task with Tomcat's Jasper JSP
  +compiler, you should seriously consider using the task shipping with
  +Tomcat instead.  This task is only tested against Tomcat 4.x. There
  +are known problems with Tomcat 5.x that won't get fixed in Ant, please
  +use Tomcat's jspc task instead.</p>
  +
   <p>
   
   It can be used to precompile JSP pages for fast initial invocation
  
  
  
  No                   revision
  No                   revision
  1.18.2.5  +46 -10    ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java
  
  Index: JasperC.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java,v
  retrieving revision 1.18.2.4
  retrieving revision 1.18.2.5
  diff -u -r1.18.2.4 -r1.18.2.5
  --- JasperC.java	9 Mar 2004 17:01:49 -0000	1.18.2.4
  +++ JasperC.java	28 Jun 2004 08:50:32 -0000	1.18.2.5
  @@ -18,6 +18,7 @@
   package org.apache.tools.ant.taskdefs.optional.jsp.compilers;
   
   import java.io.File;
  +import org.apache.tools.ant.AntClassLoader;
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.taskdefs.Java;
  @@ -52,23 +53,19 @@
           getJspc().log("Using jasper compiler", Project.MSG_VERBOSE);
           CommandlineJava cmd = setupJasperCommand();
   
  -
           try {
               // Create an instance of the compiler, redirecting output to
               // the project log
               Java java = (Java) (getProject().createTask("java"));
  +            Path p = getClasspath();
               if (getJspc().getClasspath() != null) {
  -                getProject().log("using user supplied classpath: "
  -                    + getJspc().getClasspath(), Project.MSG_DEBUG);
  -                java.setClasspath(getJspc().getClasspath()
  -                                  .concatSystemClasspath("ignore"));
  +                getProject().log("using user supplied classpath: " + p, 
  +                                 Project.MSG_DEBUG);
               } else {
  -                Path classpath = new Path(getProject());
  -                classpath = classpath.concatSystemClasspath("only");
  -                getProject().log("using system classpath: " + classpath,
  +                getProject().log("using system classpath: " + p,
                                    Project.MSG_DEBUG);
  -                java.setClasspath(classpath);
               }
  +            java.setClasspath(p);
               java.setDir(getProject().getBaseDir());
               java.setClassname("org.apache.jasper.JspC");
               //this is really irritating; we need a way to set stuff
  @@ -106,7 +103,15 @@
           JspC jspc = getJspc();
           addArg(cmd, "-d", jspc.getDestdir());
           addArg(cmd, "-p", jspc.getPackage());
  -        addArg(cmd, "-v" + jspc.getVerbose());
  +
  +        if (!isTomcat5x()) {
  +            addArg(cmd, "-v" + jspc.getVerbose());
  +        } else {
  +            getProject().log("this task doesn't support Tomcat 5.x properly, "
  +                             + "please use the Tomcat provided jspc task "
  +                             + "instead");
  +        }
  +        
           addArg(cmd, "-uriroot", jspc.getUriroot());
           addArg(cmd, "-uribase", jspc.getUribase());
           addArg(cmd, "-ieplugin", jspc.getIeplugin());
  @@ -131,5 +136,36 @@
   
       public JspMangler createMangler() {
           return mangler;
  +    }
  +
  +    /**
  +     * @since Ant 1.6.2
  +     */
  +    private Path getClasspath() {
  +        Path p = getJspc().getClasspath();
  +        if (p == null) {
  +            p = new Path(getProject());
  +            return p.concatSystemClasspath("only");
  +        } else {
  +            return p.concatSystemClasspath("ignore");
  +        }
  +    }
  +
  +    /**
  +     * @since Ant 1.6.2
  +     */
  +    private boolean isTomcat5x() {
  +        AntClassLoader l = null;
  +        try {
  +            l = getProject().createClassLoader(getClasspath());
  +            l.loadClass("org.apache.jasper.tagplugins.jstl.If");
  +            return true;
  +        } catch (ClassNotFoundException e) {
  +            return false;
  +        } finally {
  +            if (l != null) {
  +                l.cleanup();
  +            }
  +        }
       }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message