-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
158 lines (139 loc) · 6.8 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<?xml version="1.0" ?>
<project name="smt_mecanexdashboardapp" default="deploy-war">
<property name="root.dir" value="." />
<property name="sources.dir" value="${root.dir}/src" />
<property name="dist.dir" value="${root.dir}/dist" />
<property name="build.dir" value="${root.dir}/build" />
<property name="classes.dir" value="${build.dir}/classes" />
<property name="lib.dir" value="${root.dir}/libs" />
<property name="test.sources.dir" value="${root.dir}/test-src" />
<property name="test.build.dir" value="${root.dir}/test-build" />
<property name="test.classes.dir" value="${test.build.dir}/test-classes" />
<property name="tools.dir" value="${root.dir}/tools" />
<property name="webcontent.dir" value="${root.dir}/WebContent" />
<property name="webcontent.lib.dir" value="${webcontent.dir}/WEB-INF/lib" />
<property name="doc.dir" value="${root.dir}/doc"/>
<!-- Define maven-ant-tasks location -->
<property name="maven.ant.tasks.jar" value="${tools.dir}/maven-ant-tasks-2.1.3.jar"/>
<property name="maven.ant.tasks.bootstrap.location" value="http://apache.xl-mirror.nl/maven/binaries/maven-ant-tasks-2.1.3.jar"/>
<available property="maven.ant.tasks.jar.exists" file="${maven.ant.tasks.jar}"/>
<!-- Define package name and location -->
<property name="package.name.jar" value="${ant.project.name}.jar"/>
<property name="package.location.jar" value="${build.dir}/${package.name.jar}"/>
<property name="package.name.war" value="${ant.project.name}.war"/>
<property name="package.location.war" value="${dist.dir}/${package.name.war}"/>
<!-- Cleaning -->
<target name="clean" depends="clean.build.dirs, clean.test.build.dirs" />
<!-- Removes all directories -->
<target name="clean.build.dirs">
<delete dir="${dist.dir}" />
<delete dir="${build.dir}" />
<delete dir="${classes.dir}" />
<delete dir="${webcontent.lib.dir}" />
</target>
<!-- Removes all test directories -->
<target name="clean.test.build.dirs">
<delete dir="${test.build.dir}" />
<delete dir="${test.classes.dir}" />
</target>
<!-- Initialisation -->
<target name="init" depends="clean, init.build.dirs, init.maven.tasks" />
<!-- Downloads the "latest version" of the maven-ant-tasks if needed -->
<target name="bootstrap.maven.tasks" unless="maven.ant.tasks.jar.exists">
<mkdir dir="${tools.dir}"/>
<get src="${maven.ant.tasks.bootstrap.location}" dest="${maven.ant.tasks.jar}"/>
</target>
<!-- define dependencies in ant file -->
<target name="init.maven.tasks" unless="compile.classpath" depends="bootstrap.maven.tasks" xmlns:artifact="urn:maven-artifact-ant">
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpath="${maven.ant.tasks.jar}"/>
<artifact:dependencies pathId="compile.classpath" filesetId="compile.fileset" useScope="compile">
<remoteRepository id="restlet" url="http://maven.restlet.org" />
<dependency groupId="log4j" artifactId="log4j" version="1.2.16"/>
<dependency groupId="dom4j" artifactId="dom4j" version="1.6.1"/>
<dependency groupId="commons-net" artifactId="commons-net" version="2.0"/>
<dependency groupId="commons-httpclient" artifactId="commons-httpclient" version="3.1"/>
<dependency groupId="jaxen" artifactId="jaxen" version="1.1.1"/>
<dependency groupId="org.restlet.jee" artifactId="org.restlet" version="2.0.10"/>
<dependency groupId="org.restlet.jee" artifactId="org.restlet.ext.xml" version="2.0.10"/>
<dependency groupId="org.restlet.jee" artifactId="org.restlet.ext.servlet" version="2.0.10"/>
</artifact:dependencies>
<artifact:dependencies pathId="test.classpath" filesetId="test.fileset" useScope="test">
</artifact:dependencies>
<artifact:dependencies pathId="provided.classpath" filesetId="provided.fileset">
<dependency groupId="javax.servlet" artifactId="servlet-api" version="2.5" scope="provided"/>
</artifact:dependencies>
<artifact:dependencies pathId="runtime.classpath" filesetId="runtime.fileset">
</artifact:dependencies>
</target>
<!-- still dependent on local libraries -->
<path id="lib.classpath">
<fileset id="lib.fileset" dir="${lib.dir}" includes="*.jar"/>
</path>
<!-- Creates all necessary directories -->
<target name="init.build.dirs">
<mkdir dir="${dist.dir}" />
<mkdir dir="${build.dir}" />
<mkdir dir="${classes.dir}" />
<mkdir dir="${webcontent.lib.dir}" />
</target>
<!-- Creates all necessary directories -->
<target name="init.test.build.dirs">
<mkdir dir="${test.build.dir}" />
<mkdir dir="${test.classes.dir}" />
</target>
<!-- copy our dependencies from maven's struture into our lib directory -->
<target name="copy.dependencies" depends="init">
<copy todir="${webcontent.lib.dir}">
<fileset refid="compile.fileset" />
<fileset refid="lib.fileset" />
<mapper type="flatten" />
</copy>
</target>
<!-- Compilation initialisation -->
<target name="compile.init" depends="init, copy.dependencies" />
<!-- Copile java code -->
<target name="compile" depends="compile.init">
<javac srcdir="${sources.dir}" destdir="${classes.dir}" debug="on">
<classpath>
<path refid="provided.classpath"/>
<path refid="compile.classpath"/>
<path refid="lib.classpath"/>
</classpath>
</javac>
</target>
<!-- Jar package build -->
<target name="build" depends="compile">
<delete file="${package.location.jar}"/>
<jar jarfile="${package.location.jar}" basedir="${classes.dir}">
<manifest>
<attribute name="Built-By" value="Noterik B.V."/>
<attribute name="Main-Class" value=""/>
</manifest>
</jar>
</target>
<!-- War package build -->
<target name="deploy-war" depends="clean, build">
<copy todir="${webcontent.lib.dir}" file="${package.location.jar}" />
<war destfile="${package.location.war}" webxml="${webcontent.dir}/WEB-INF/web.xml">
<fileset dir="${webcontent.dir}">
<exclude name="WEB-INF/lib/lou.jar" />
<exclude name="WEB-INF/lib/mojo.jar" />
<exclude name="WEB-INF/lib/springfield-tools.jar" />
<exclude name="WEB-INF/lib/c*" />
<exclude name="WEB-INF/lib/x*" />
<exclude name="WEB-INF/lib/o*" />
<exclude name="WEB-INF/lib/d*" />
<exclude name="WEB-INF/lib/i*" />
<exclude name="WEB-INF/lib/j*" />
<exclude name="WEB-INF/lib/l*" />
<exclude name="WEB-INF/web.xml" />
</fileset>
</war>
<!-- <copyfile src="${package.location.war}" dest="/springfield/lou/uploaddir/smt_portiatestapp.war"/> -->
<!--<scp file="${package.location.war}" todir="root@a1.noterik.com:/springfield/lou/uploaddir" knownhosts="/Users/pieter/.ssh/known_hosts" trust="true" passphrase="" keyfile="/Users/pieter/.ssh/ntk_rsa" lib="${lib.dir}/jsch.jar" />-->
<!--<exec executable="/bin/bash">
remove this line or use your own auto deploy method to get it into the lou upload dir
<arg value="/springfield/tomcat/bin/installapp_mecanex.sh"/>
</exec>-->
</target>
</project>