source: trunk/jsp-precompile.xml @ 7607

Last change on this file since 7607 was 7607, checked in by Nicklas Nordborg, 3 years ago

References #2151: Pre-compile all JSP pages before releases

Printing the path to Tomcat home when compiling.

File size: 3.2 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3    $Id$
4
5    This file is part of BASE - BioArray Software Environment.
6    Available at http://base.thep.lu.se/
7
8    BASE is free software; you can redistribute it and/or modify it
9    under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 3 of the License, or
11    (at your option) any later version.
12
13    BASE is distributed in the hope that it will be useful, but
14    WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16    General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with BASE. If not, see <http://www.gnu.org/licenses/>.
20-->
21<project
22  name="JspPrecompile"
23  default="all"
24  basedir="."
25  >
26 
27  <!--
28    Required parameters:
29    tomcat.home = path to Tomcat installation directory
30    jsp.src = path to directory containing JSP files to be compile
31    jsp.build = path to working directory where intermediate .java files and compiled .class files should be saved
32    javac.source, javac.target = source and target version of java files
33  -->
34  <property name="javac.encoding" value="UTF-8" />
35  <property name="javac.bootclasspath" value="." />
36  <!--
37    Use Xlint to detect potential problems:
38    -serial is needed since jasper doesn't generate a serialVersionUID
39  -->
40  <property name="jsp.xlint" value="all,-serial" />
41 
42  <import file="${tomcat.home}/bin/catalina-tasks.xml" />
43 
44  <!-- 'compile' JSP files to Java files -->
45  <target name="jspc">
46    <mkdir dir="${jsp.build}/java" /> <!-- output directory for *.java files -->
47    <echo>Using Tomcat in: ${tomcat.home}</echo>
48    <jasper
49      validateXml="false"
50      uriroot="${jsp.src}"
51      outputDir="${jsp.build}/java" 
52      webXmlFragment="${jsp.build}/generated_web.xml"
53      javaencoding="${javac.encoding}"
54      strictQuoteEscaping="false"
55    />
56  </target>
57 
58  <target name="compile">
59   
60    <path id="boot.classpath">
61      <fileset dir="${javac.bootclasspath}">
62        <include name="lib/*.jar" />
63      </fileset>
64    </path>
65   
66    <path id="compile.classpath">
67      <pathelement location="${jsp.src}/WEB-INF/classes" />
68      <fileset dir="${jsp.src}/WEB-INF/lib">
69        <include name="*.jar" />
70      </fileset>
71      <pathelement location="${tomcat.home}/lib" />
72      <fileset dir="${tomcat.home}/lib">
73        <include name="*.jar"/>
74      </fileset>
75      <fileset dir="${tomcat.home}/bin">
76        <include name="*.jar"/>
77      </fileset>
78    </path>
79   
80    <mkdir dir="${jsp.build}/classes" /> <!-- output directory for *.class files -->
81    <echo>Using Xlint:${jsp.xlint}</echo>
82    <echo>Override this by setting 'jsp.xlint' in 'build.properties'</echo>
83    <javac
84      destdir="${jsp.build}/classes"
85      srcdir="${jsp.build}/java"
86      classpathref="compile.classpath"
87      bootclasspathref="boot.classpath"
88      fork="true"
89      debug="true"
90      includeantruntime="false"
91      source="${javac.source}"
92      target="${javac.target}"
93      encoding="${javac.encoding}"
94      >
95      <compilerarg value="-Xlint:${jsp.xlint}" />
96      <exclude name="org/apache/jsp/extensions/**" />
97    </javac>
98  </target>
99 
100  <target name="all" depends="jspc,compile" />
101</project>
Note: See TracBrowser for help on using the repository browser.