diff --git a/docs/manual/OptionalTasks/jspc.html b/docs/manual/OptionalTasks/jspc.html index 83de8628b..2862cd39e 100644 --- a/docs/manual/OptionalTasks/jspc.html +++ b/docs/manual/OptionalTasks/jspc.html @@ -107,6 +107,20 @@ The Task has the following attributes:
compiler
attribute.The mapped option will, if set to true, split the JSP text content into a @@ -155,6 +169,10 @@ classpath.
compiler
<jspc srcdir="${basedir}/src/war" diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java b/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java index df024f813..1da9c906d 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java @@ -60,6 +60,7 @@ import java.util.Date; import java.util.Vector; import java.util.Enumeration; +import org.apache.tools.ant.AntClassLoader; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.Project; @@ -113,6 +114,7 @@ import org.apache.tools.ant.types.Reference; public class JspC extends MatchingTask { /* ------------------------------------------------------------ */ private Path classpath; + private Path compilerClasspath; private Path src; private File destDir; private String packageName ; @@ -297,6 +299,35 @@ public class JspC extends MatchingTask { return classpath; } + /* ------------------------------------------------------------ */ + /** + * Set the classpath to be used to find this compiler adapter + */ + public void setCompilerclasspath(Path cp) { + if (compilerClasspath == null) { + compilerClasspath = cp; + } else { + compilerClasspath.append(cp); + } + } + + /** + * get the classpath used to find the compiler adapter + */ + public Path getCompilerclasspath(){ + return compilerClasspath; + } + + /** + * Support nested compiler classpath, used to locate compiler adapter + */ + public Path createCompilerclasspath() { + if (compilerClasspath == null) { + compilerClasspath = new Path(project); + } + return compilerClasspath.createPath(); + } + /** * -webxml <file> Creates a complete web.xml when using the -webapp option. * @@ -384,7 +415,8 @@ public class JspC extends MatchingTask { //bind to a compiler JspCompilerAdapter compiler = - JspCompilerAdapterFactory.getCompiler(compilerName, this); + JspCompilerAdapterFactory.getCompiler(compilerName, this, + new AntClassLoader(getProject(), compilerClasspath)); // if the compiler does its own dependency stuff, we just call it right now if (compiler.implementsOwnDependencyChecking()) { diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JspCompilerAdapterFactory.java b/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JspCompilerAdapterFactory.java index 4717ed04e..7db9c526b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JspCompilerAdapterFactory.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JspCompilerAdapterFactory.java @@ -53,6 +53,7 @@ */ package org.apache.tools.ant.taskdefs.optional.jsp.compilers; +import org.apache.tools.ant.AntClassLoader; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Task; @@ -87,13 +88,37 @@ public class JspCompilerAdapterFactory { */ public static JspCompilerAdapter getCompiler(String compilerType, Task task) throws BuildException { + return getCompiler(compilerType, task, + new AntClassLoader(task.getProject(), null)); + } + + /** + * Based on the parameter passed in, this method creates the necessary + * factory desired. + * + * The current mapping for compiler names are as follows: + *