A build script to check the JSPs for compile errors.
This commit is contained in:
parent
6777487b46
commit
113fe53242
1 changed files with 80 additions and 0 deletions
80
utilities/pre-compileJSPs/jsp-build.xml
Normal file
80
utilities/pre-compileJSPs/jsp-build.xml
Normal file
|
@ -0,0 +1,80 @@
|
|||
<project name="Check JSPs for compile errors" default="all" basedir="../..">
|
||||
<!-- Get tomcat.home and webapp.name from the deploy.properties file. -->
|
||||
<property name="deploy.properties.file" location="deploy.properties" />
|
||||
<fail message="You must create a "${deploy.properties.file}" file.">
|
||||
<condition>
|
||||
<not>
|
||||
<available file="${deploy.properties.file}" />
|
||||
</not>
|
||||
</condition>
|
||||
</fail>
|
||||
<property file="${deploy.properties.file}" />
|
||||
<fail unless="tomcat.home"
|
||||
message="${deploy.properties.file} must contain a value for tomcat.home" />
|
||||
<fail unless="webapp.name"
|
||||
message="${deploy.properties.file} must contain a value for webapp.name" />
|
||||
|
||||
<property name="build.jsp.dir" location=".build/jsp" />
|
||||
<property name="build.war.dir" location=".build/war" />
|
||||
|
||||
<!-- Where are the Tomcat classes? -->
|
||||
<path id="jasper.classpath">
|
||||
<fileset dir="${tomcat.home}/bin">
|
||||
<include name="*.jar" />
|
||||
</fileset>
|
||||
<fileset dir="${tomcat.home}/lib">
|
||||
<include name="*.jar" />
|
||||
</fileset>
|
||||
</path>
|
||||
|
||||
<!-- Add in the project classes -->
|
||||
<path id="compile.classpath">
|
||||
<path refid="jasper.classpath" />
|
||||
<pathelement location="${build.war.dir}/WEB-INF/classes" />
|
||||
<fileset dir="${build.war.dir}/WEB-INF/lib">
|
||||
<include name="*.jar" />
|
||||
</fileset>
|
||||
</path>
|
||||
|
||||
<!-- Define the Jasper task -->
|
||||
<taskdef classname="org.apache.jasper.JspC" name="jasper2">
|
||||
<classpath refid="jasper.classpath" />
|
||||
</taskdef>
|
||||
|
||||
<target name="clean"
|
||||
description="Delete all build artifacts, so the next build starts from a clean slate">
|
||||
<delete dir="${build.jsp.dir}" />
|
||||
</target>
|
||||
|
||||
<target name="prepare">
|
||||
<mkdir dir="${build.jsp.dir}" />
|
||||
<mkdir dir="${build.jsp.dir}/src" />
|
||||
<mkdir dir="${build.jsp.dir}/classes" />
|
||||
</target>
|
||||
|
||||
<target name="jspc" depends="prepare">
|
||||
<jasper2 validateXml="false"
|
||||
uriroot="${build.war.dir}"
|
||||
webXmlFragment="${build.jsp.dir}generated_web.xml"
|
||||
outputDir="${build.jsp.dir}/src"
|
||||
trimSpaces="true"
|
||||
failOnError="false" />
|
||||
</target>
|
||||
|
||||
<target name="compile" depends="jspc">
|
||||
<javac destdir="${build.jsp.dir}/classes"
|
||||
optimize="off"
|
||||
debug="off"
|
||||
failonerror="true"
|
||||
srcdir="${build.jsp.dir}/src"
|
||||
excludes="**/*.smap">
|
||||
<classpath refid="compile.classpath" />
|
||||
<include name="**" />
|
||||
<exclude name="tags/**" />
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<target name="all"
|
||||
depends="clean, compile"
|
||||
description="Compile the JSPs to classfiles, just to check for compile errors." />
|
||||
</project>
|
Loading…
Add table
Reference in a new issue