-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.xml
More file actions
210 lines (175 loc) · 7.67 KB
/
Copy pathbuild.xml
File metadata and controls
210 lines (175 loc) · 7.67 KB
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<project default="help" basedir="."
xmlns:rsel="antlib:org.apache.tools.ant.types.resources.selectors"
xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="antlib:org.apache.maven.artifact.ant"
classpath="utils/ant/maven-ant-tasks-2.1.3.jar"/>
<property name="build.dir" value="build"/>
<property name="build.classes" value="${build.dir}/WEB-INF/classes"/>
<target name="help">
<java classname="org.apache.tools.ant.Main"><arg value="-projecthelp"/></java>
</target>
<target name="clean" description="clean the project" >
<delete dir="src/main/webapp/libs" />
<delete dir="${build.dir}" />
<delete dir="tmp" />
</target>
<target name="prepare" >
<mkdir dir="${build.dir}" />
<mkdir dir="${build.classes}" />
<condition property="need-download-jars">
<not>
<and>
<available file="${build.dir}/WEB-INF/lib" type="dir" />
<available file="tmp/compile-lib" type="dir" />
</and>
</not>
</condition>
<condition property="need-download-webjars">
<not>
<available file="src/main/webapp/libs" type="dir" />
</not>
</condition>
</target>
<target name="download" depends="download-jars,download-webjars" />
<property name="jetty-version" value="8.1.9.v20130131" />
<target name="download-webjars" depends="prepare" if="need-download-webjars">
<artifact:remoteRepository id="https_central" url="https://repo.maven.apache.org/maven2" />
<artifact:pom id="mypom" file="pom.xml" />
<artifact:dependencies filesetId="jar.fileset" scopes="provided" pomRefId="mypom"><remoteRepository refid="https_central" /></artifact:dependencies>
<restrict id="webjars.list">
<fileset refid="jar.fileset" />
<rsel:name name="**/webjars/**" />
</restrict>
<delete dir="src/main/webapp/libs" />
<unzip dest="src/main/webapp/libs">
<restrict refid="webjars.list" />
<patternset>
<include name="META-INF/resources/webjars/" />
</patternset>
<mapper type="glob" from="META-INF/resources/webjars/*" to="*"/>
</unzip>
</target>
<target name="download-jars" depends="prepare" if="need-download-jars">
<artifact:remoteRepository id="https_central" url="https://repo.maven.apache.org/maven2" />
<artifact:pom id="mypom" file="pom.xml" />
<artifact:dependencies filesetId="runtime.jar.fileset" useScope="runtime" pomRefId="mypom"><remoteRepository refid="https_central"/></artifact:dependencies>
<artifact:dependencies filesetId="compile.jar.fileset" useScope="compile" pomRefId="mypom"><remoteRepository refid="https_central"/></artifact:dependencies>
<mkdir dir="${build.dir}/WEB-INF/lib" />
<copy todir="${build.dir}/WEB-INF/lib">
<fileset refid="runtime.jar.fileset"/>
<mapper type="flatten"/>
</copy>
<mkdir dir="tmp/compile-lib" />
<copy todir="tmp/compile-lib">
<fileset refid="compile.jar.fileset"/>
<mapper type="flatten"/>
</copy>
</target>
<target name="compile" depends="download" description="compile the project" >
<property name="compile.debug" value="true" />
<property name="compile.deprecation" value="true" />
<property name="compile.optimize" value="true" />
<property name="compile.nowarn" value="false" />
<path id="compile.classpath">
<fileset dir="tmp/compile-lib" includes="**/*.jar" />
</path>
<javac
srcdir="src/main/java"
destdir="${build.classes}"
debug="${compile.debug}"
nowarn="${compile.nowarn}"
deprecation="${compile.deprecation}"
includeantruntime="false"
source="1.7"
target="1.7"
optimize="${compile.optimize}">
<classpath refid="compile.classpath" />
</javac>
<copy todir="${build.classes}/properties" overwrite="true" >
<fileset dir="src/main/resources/properties" />
</copy>
<copy todir="${build.classes}/database" overwrite="true" >
<fileset dir="src/main/resources/database" />
</copy>
</target>
<target name="deploy" depends="compile" description="deploy the application" >
<property file="build.properties" />
<fail unless="deploy.home" message="Please set property deploy.home in build.properties" />
<sync todir="${deploy.home}" overwrite="true" >
<fileset dir="src/main/webapp" />
<fileset dir="${build.dir}" excludes="WEB-INF/classes/org/esupportail/commons/portal/ws/**/*" />
</sync>
</target>
<!-- ******************************************************************************** -->
<!-- * below are helper targets ***************************************************** -->
<!-- ******************************************************************************** -->
<target name="generate-ddl" depends="ant-extra,compile">
<path id="all.classpath">
<fileset dir="tmp/ant-extra" includes="*.jar"/>
<fileset dir="tmp/compile-lib" includes="*.jar" />
</path>
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="all.classpath" />
<hibernatetool>
<classpath><path location="${build.classes}"/></classpath>
<configuration propertyfile="src/main/resources/properties/config.properties">
<fileset dir="src/main/resources/properties/dao">
<include name="**/*.hbm.xml"/>
</fileset>
</configuration>
<hbm2ddl export="no" destdir="src/main/resources/database" outputfilename="create_tables.sql"/>
</hibernatetool>
</target>
<target name="hotswap" depends="tstamp,compile">
<taskdef name="hotswap" classname="dak.ant.taskdefs.Hotswap">
<classpath>
<pathelement location="utils/ant/hotswap.jar"/>
</classpath>
</taskdef>
<property file="build.properties" />
<hotswap verbose="true" port="${jpdaAddress}">
<fileset dir="${build.classes}" includes="**/*.class">
<date datetime="${date}" pattern="d-MMMM-yyyy HH:mma" when="after"/>
</fileset>
</hotswap>
</target>
<target name="tstamp">
<tstamp>
<!-- for hotswap target -->
<format property="date" pattern="d-MMMM-yyyy HH:mma" locale="en"/>
</tstamp>
</target>
<target name="prepare-ant-extra">
<condition property="need-download-ant-extra">
<not><available file="tmp/ant-extra" type="dir" /></not>
</condition>
</target>
<target name="download-ant-extra" if="need-download-ant-extra">
<artifact:remoteRepository id="https_central" url="https://repo.maven.apache.org/maven2" />
<artifact:dependencies filesetId="ant-extra.fileset">
<remoteRepository refid="https_central" />
<dependency groupId="org.mortbay.jetty" artifactId="jetty-ant" version="${jetty-version}" />
<dependency groupId="org.hibernate" artifactId="hibernate-tools" version="4.3.5.Final" />
</artifact:dependencies>
<copy todir="tmp/ant-extra">
<fileset refid="ant-extra.fileset"/>
<mapper type="flatten"/>
</copy>
</target>
<target name="ant-extra" depends="prepare-ant-extra,download-ant-extra" />
<target name="jetty.run" depends="ant-extra,compile" description="test using jetty">
<property file="build.properties" />
<path id="jetty.plugin.classpath">
<fileset dir="tmp/ant-extra" includes="*.jar"/>
</path>
<taskdef classpathref="jetty.plugin.classpath" resource="tasks.properties" loaderref="jetty.loader" />
<jetty tempDirectory="tmp/jetty-temp" jettyPort="${jetty.port}">
<webApp name="myApp" warfile="src/main/webapp" contextpath="/">
<lib dir="${build.dir}/WEB-INF/lib" includes="*.jar" />
<classes dir="${build.classes}" includes="*.class" />
</webApp>
</jetty>
</target>
</project>