This repository has been archived by the owner on Jun 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.xml
112 lines (91 loc) · 3.98 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?xml version="1.0"?>
<project name="basic command plugins" default="all">
<!-- Include build and deployment options -->
<property file="build.properties" prefix="build"/>
<property name="build.dir" value="build" />
<property name="build.javac.target" value="1.7"/>
<property name="build.javac.source" value="1.7"/>
<property name="build.dist.name" value="kitodo-contentserver" />
<property name="build.dist.version" value="3.0.0" />
<property name="dist.dir" value="dist" />
<property name="jarfile" value="${build.dist.name}-${build.dist.version}.jar" />
<property name="warfile" value="${build.dist.name}-${build.dist.version}.war" />
<property name="dir.lib" value="${basedir}/WebContent/WEB-INF/lib" />
<property name="src.dir" value="${basedir}/src" />
<!-- normally overridden in build.properties -->
<property name="build.tomcat.dir.lib" value="${dir.lib}" />
<path id="compile.classpath">
<fileset dir="${dir.lib}" />
<fileset dir="${build.tomcat.dir.lib}" />
<pathelement location="${build.servlet.jar}" />
<pathelement path="${java.class.path}" />
</path>
<target name="all" depends="war" />
<target name="clean">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>
<target name="checkServletClassPath">
<condition property="servletapi.present">
<available classname="javax.servlet.http.HttpServlet" classpathref="compile.classpath" />
</condition>
</target>
<target name="checkConditions" depends="checkJavaVersion, checkServletApi" />
<!-- check for Java version 1.7 -->
<target name="checkJavaVersion">
<fail message="Build required at least version 1.7 of the Java compiler ">
<condition>
<and>
<contains string="${java.version}" substring="1.0"/>
<contains string="${java.version}" substring="1.1"/>
<contains string="${java.version}" substring="1.2"/>
<contains string="${java.version}" substring="1.3"/>
<contains string="${java.version}" substring="1.4"/>
<contains string="${java.version}" substring="1.5"/>
<contains string="${java.version}" substring="1.6"/>
</and>
</condition>
</fail>
</target>
<target name="checkServletApi" depends="checkServletClassPath" unless="servletapi.present">
<echo>Servlet API not found on classpath!</echo>
<echo>run this build file via "ant -lib /path/to/servlet-api.jar or set build.tomcat.dir.lib property"</echo>
<fail message="Servlet API is missing."/>
</target>
<target name="copyAdditionalNonJavaFiles">
<copy todir="${build.dir}">
<fileset dir="${src.dir}">
<exclude name="**/*.java" />
</fileset>
</copy>
</target>
<target name="createDirectories">
<mkdir dir="${build.dir}" />
<mkdir dir="${dist.dir}" />
</target>
<!-- jar build process -->
<target name="jar" depends="checkConditions, createDirectories, copyAdditionalNonJavaFiles">
<echo>compile sources</echo>
<javac destdir="build"
includeAntRuntime="false"
source="${build.javac.source}"
target="${build.javac.target}"
encoding="UTF-8"
debug="true"
debuglevel="lines,vars,source"
classpathref="compile.classpath"
srcdir="${src.dir}">
</javac>
<echo>generate jar file</echo>
<jar destfile="${dist.dir}/${jarfile}">
<fileset dir="${build.dir}" />
</jar>
</target>
<target name="war" depends="jar">
<war destfile="${dist.dir}/${warfile}" webxml="WebContent/WEB-INF/web.xml">
<fileset dir="WebContent"/>
<lib dir="${dir.lib}"/>
<classes dir="${build.dir}"/>
</war>
</target>
</project>