It can be done in similar way as for Tomcat Application Server (see this link). The only difference is: we have another JSP compiler which takes different input parameters and expects JSP pages in well specified locations. It does not "like" JSP pages within WEB-INF folder, so you need to follow this rule. Otherwise you have to copy files with "wrong" locations into "right" locations.
1. Specify "project.classpath" for your project. It will include all jars required to compile or run your project:
<path id="project.classpath">
...
</path>
2. Specify "weblogic.jsp.classpath". You need to have Weblogic Web Server installed ar ${weblogic.home}. You also need to specify, where you have your implementation of logging system ("${repository.home}/log4j").
<path id="weblogic.jsp.classpath">
<!-- 1. You have to include jars from your project. -->
<path refid="project.classpath"/>
<!-- 2. Weblogic jsp compiler and dependent classes (including JavaEE/Servlet/JSP interface classes). -->
<fileset dir="${weblogic.home}/server/lib">
<include name="weblogic.jar"/>
</fileset>
<!-- 3. This library is required by Weblogic jsp compiler (not in weblogic installation!). -->
<fileset dir="${repository.home}/saxpath">
<include name="saxpath-1.0-FCS.jar"/>
</fileset>
<!-- 4. Weblogic jsp compiler internally uses Java compiler. -->
<fileset dir="${java.home}/lib">
<include name="tools.jar"/>
</fileset>
<fileset dir="${java.home}/../lib">
<include name="tools.jar"/>
</fileset>
<!-- 5. Implementation of logging system (if it is not in "project.classpath" yet). -->
<fileset dir="${global.repository.home}/log4j">
<include name="log4j-1.2.8.jar"/>
</fileset>
</path>
3. Now we can generate Java sources for JSP files.
<property name="jsp.src.dir" value="<the root for your JSP files>"/>
<property name="jsp.package.name" value="<the package name for your JSPs, like com.mycompany.jsp>"/>
<property name="build.dir" value="target/build"/>
<property name="jsp.generated.src.dir" value="${build.dir}/jsp_sources"/>
<property name="jsp.classes.dir" value="${build.dir}/jsp_classes"/>
<target name="tomcat.jsp.generate">
<mkdir dir="${jsp.generated.src.dir}"/>
<mkdir dir="${jsp.classes.dir}"/>
<java classname="org.apache.jasper.JspC" fork="yes">
<classpath refid="tomcat.jsp.classpath" />
<arg line="-uriroot ${jsp.src.dir} -d ${jsp.generated.src.dir} -p ${jsp.package.name} -webapp ${jsp.src.dir}" />
</java>
</target>
<target name ="weblogic.jsp.generate">
<mkdir dir="${jsp.generated.src.dir}"/>
<mkdir dir="${jsp.classes.dir}"/>
<java classname="weblogic.jspc" fork="yes">
<classpath refid="weblogic.jsp.classpath" />
<sysproperty key="weblogic.jsp.windows.caseSensitive" value="false"/>
<arg line="-forceGeneration -keepgenerated -compileAll -webapp ${jsp.src.dir} -d ${jsp.generated.src.dir}"/>
</java>
</target>
It is very important to set "weblogic.jsp.windows.caseSensitive" to "false". At the same step Weblogic will compile Java sources into Java classes (-forceGeneration and -keepgenerated). Compiled JSP java classes will be located in same folders as JSP compiled classes. We will separate them on next step.
You don't have to specify package name for JSP pages. JSP compiler will assign default "jsp_servlet" package name for all JSP pages. Each folder will be converted with the "_" prefix plus original name, each jsp page into "__" prefix plus original name.
4. Now, it's better to separate generated Java sources from compiled files.
<target name ="weblogic.jsp.compile" depends="weblogic.jsp.generate"
description="Separates sources from classes">
<move todir="${jsp.classes.dir}/jsp_servlet">
<fileset dir="${jsp.generated.src.dir}/jsp_servlet">
<include name="**/*.class"/>
</fileset>
</move>
</target>
If, on this step you don't have compiler errors, your source code (JSP part) is not broken.
When you assemble war file, you should include everything from ${jsp.src.dir} folder except JSP files and their includes.
-