Newer
Older
<?xml version="1.0" encoding="UTF-8"?>
<project name="minerva" default="main" basedir=".">
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
113
114
115
116
117
118
119
120
121
122
<property environment="env"/>
<property name="build.dir" value="web/target"/>
<property name="war.file" value="web-1.0.war"/>
<property name="tomcat.home" value="${env.CATALINA_HOME}"/>
<property name="tomcat.deploy.dir" value="${tomcat.home}/webapps"/>
<condition property="isWindows">
<os family="windows"/>
</condition>
<condition property="isUnix">
<os family="unix"/>
</condition>
<target name="war-exists">
<available file="${tomcat.deploy.dir}/${ant.project.name}.war" property="war.exists"/>
</target>
<target name="remove-war" depends="war-exists" if="war.exists">
<delete file="${tomcat.deploy.dir}/${ant.project.name}.war"/>
</target>
<target name="war-dir-exists">
<available file="${tomcat.deploy.dir}/${ant.project.name}" property="war-dir.exists" type="dir"/>
</target>
<target name="remove-war-dir" depends="war-dir-exists" if="war-dir.exists">
<delete dir="${tomcat.deploy.dir}/${ant.project.name}"/>
</target>
<target name="deploy" depends="remove-war,remove-war-dir">
<copy file="${build.dir}/${war.file}" todir="${tomcat.deploy.dir}"/>
<move file="${tomcat.deploy.dir}/${war.file}" tofile="${tomcat.deploy.dir}/${ant.project.name}.war"/>
</target>
<target name="main" depends="tomcat-stop,maven-build,deploy,tomcat-start">
</target>
<target name="all" depends="main">
</target>
<target name="tomcat-start" depends="tomcat-start-windows, tomcat-start-unix"/>
<target name="tomcat-start-windows" if="isWindows">
<exec executable="${tomcat.home}/bin/startup.bat"/>
</target>
<target name="tomcat-start-unix" if="isUnix">
<exec executable="${tomcat.home}/bin/startup.sh"/>
</target>
<target name="tomcat-stop" depends="tomcat-stop-windows, tomcat-stop-unix"/>
<target name="tomcat-stop-windows" if="isWindows">
<exec executable="${tomcat.home}/bin/shutdown.bat"/>
</target>
<target name="tomcat-stop-unix" if="isUnix">
<exec executable="${tomcat.home}/bin/shutdown.sh"/>
</target>
<target name="maven-build" depends="gitversion, maven-build-windows, maven-build-unix"/>
<target name="maven-build-windows" if="isWindows">
<exec dir="." executable="cmd">
<arg line="/c mvn -Dmaven.test.skip=true clean install -pl web -am"/>
</exec>
</target>
<target name="maven-build-unix" if="isUnix">
<exec dir="." executable="sh">
<arg line="-c 'mvn -Dmaven.test.skip=true clean install -pl web -am'"/>
</exec>
</target>
<target name="maven-test" depends="maven-test-windows, maven-test-unix"/>
<target name="maven-test-windows" depends="maven-build" if="isWindows">
<exec dir="." executable="cmd">
<arg line="/c mvn test -fn"/>
<!-- <arg line="/c mvn surefire-report:report" /> -->
</exec>
</target>
<target name="maven-test-unix" depends="maven-build" if="isUnix">
<exec dir="." executable="sh">
<arg line="-c 'mvn test -fn'"/>
<!-- <arg line="-c 'mvn surefire-report:report'" /> -->
</exec>
</target>
<target name="deployMapFiles">
<copy todir="${tomcat.deploy.dir}/map_images">
<fileset dir="map_images"/>
</copy>
</target>
<target name="gitversion">
<exec executable="git" outputproperty="gitversion">
<arg value="rev-parse"/>
<arg value="HEAD"/>
</exec>
<tstamp>
<format property="build.time" pattern="dd/MM/yyyy HH:mm"
unit="hour"/>
</tstamp>
<echo>GIT Version: ${gitversion}
Build timestamp: ${build.time}
</echo>
<echo file="web/src/main/webapp/version.txt">${gitversion}
${build.time}
</echo>
<copy file="CHANGELOG" tofile="web/src/main/webapp/CHANGELOG" overwrite="true"/>
</target>
<target name="debian-pkg" depends="maven-build">
<exec executable="debian/create-debian-pkg.sh"/>
</target>