forked from dustin/java-memcached-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
711 lines (639 loc) · 28.6 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
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
<!--
Copyright (c) 2009-2012 Couchbase, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<project name="spymemcached" default="package"
xmlns:artifact="urn:maven-artifact-ant"
xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- load ant-contrib tasks to get the "if" task. -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${basedir}/lib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<property name="name" value="spymemcached"/>
<property name="copyright" value="2006-2011 Dustin Sallings, Matt Ingenthron" />
<property name="group" value="net.spy" />
<property name="base.src.dir" value="${basedir}/src" />
<property name="build.dir" value="${basedir}/build" />
<property name="build.src.dir" value="${build.dir}/src" />
<property name="etc.dir" value="${basedir}/etc" />
<property name="lib.dir" value="${basedir}/lib" />
<property name="src.dir" value="${base.src.dir}/main/java" />
<property name="test.dir" value="${base.src.dir}/test/java" />
<property name="script.src.dir" value="${base.src.dir}/scripts" />
<property name="build.javadoc" location="${build.dir}/docs/" />
<property name="build.javadoc.test" location="${build.dir}/testdocs/" />
<property name="junit.dir" location="${build.dir}/junit" />
<property name="dist.dir" value="${basedir}/target" />
<property name="build.classes" location="${build.dir}/classes"/>
<property name="git.hash" value="" />
<var name="version" value="no-version"/>
<!-- ivy properties used -->
<property name="ivy.settings.dir" value="${basedir}/ivy" />
<property name="ivy.pom.url"
value="http://www.couchbase.org/code/couchbase/java" />
<property name="ivy.pom.groupId" value="net.spy" />
<property name="ivy.pom.description"
value = "A client library for memcached."/>
<property name="ivy.pom.name" value="Spymemcached" />
<path id="test.classpath">
<pathelement location="${build.classes}" />
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<!-- tests -->
<property name="build.test" location="${build.dir}/test"/>
<property name="test.log.dir" location="${build.dir}/test/logs"/>
<property name="build.test.classes" location="${build.test}/classes" />
<!-- maven -->
<property name="mvn.build.dir" value="${build.dir}" />
<!-- compilation -->
<property name="javac.deprecation" value="off"/>
<property name="javac.debug" value="on"/>
<property name="build.encoding" value="ISO-8859-1"/>
<!-- Checking code style -->
<property name="checkstyle.xml" value="${etc.dir}/checkstyle.xml" />
<property name="checkstyle.format.xsl" value="${etc.dir}/checkstyle-noframes.xsl" />
<property name="checkstyle.report.dir" value="${build.dir}/checkstyle" />
<!-- static analysis -->
<property name="findbugs.out.dir" value="${build.dir}/findbugs" />
<property name="findbugs.output.xml.file"
value="${findbugs.out.dir}/report.xml" />
<property name="findbugs.output.html.file"
value="${findbugs.out.dir}/report.html" />
<!-- Ivy-based dependency resolution -->
<property name="ivy.dir" location="${basedir}/ivy" />
<property name="ivysettings.xml" location="${ivy.dir}/ivysettings.xml"/>
<loadproperties srcfile="${ivy.dir}/libraries.properties"/>
<property name="ivy.jar" location="${lib.dir}/ivy-${ivy.version}.jar"/>
<property name="ivy_repo_url"
value="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar" />
<property name="mvn_repo_url"
value="http://repo2.maven.org/maven2/org/apache/maven/maven-ant-tasks/${mvn.version}/maven-ant-tasks-${mvn.version}.jar"/>
<property name="mvn.jar" location="${build.dir}/maven-ant-tasks-${mvn.version}.jar" />
<property name="build.ivy.dir" location="${build.dir}/ivy" />
<property name="build.ivy.lib.dir" location="${build.ivy.dir}/lib" />
<property name="build.ivy.report.dir" location="${build.ivy.dir}/report" />
<property name="redist.ivy.lib.dir" location="${build.ivy.lib.dir}/${name}/redist"/>
<!--test related properties -->
<property name="server.address_v4" value="127.0.0.1"/>
<property name="server.address_v6" value="::1"/>
<property name="server.port_number" value="11211"/>
<property name="test.type" value="unit"/>
<!--this is the naming policy for artifacts we want pulled down-->
<property name="ivy.artifact.retrieve.pattern"
value="${name}/[conf]/[artifact]-[revision](-[classifier]).[ext]"/>
<!-- maven central repo urls -->
<property name="maven-snapshots-repository-id" value="sonatype-nexus-snapshots" />
<property name="maven-snapshots-repository-url" value="https://oss.sonatype.org/content/repositories/snapshots/" />
<property name="maven-staging-repository-id" value="sonatype-nexus-staging" />
<property name="maven-staging-repository-url" value="https://oss.sonatype.org/service/local/staging/deploy/maven2/" />
<!-- paths used for compilation and run -->
<path id="lib.path.id">
<fileset dir="${lib.dir}" />
</path>
<path id="run.path.id">
<path refid="lib.path.id" />
<path location="${build.dir}" />
</path>
<!-- The classpath for compiling and running Spymemcached -->
<path id="compile.classpath">
<pathelement location="${build.classes}"/>
<path refid="lib.path"/>
<path refid="${name}.common.classpath"/>
</path>
<!-- ======================================
Section: Initializing
====================================== -->
<target name="init">
<!-- Path containing third-party libraries deployed directly with spymemcached.
This does not include anything that Ivy can retrieve for us.
-->
<path id="lib.path">
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
</path>
<!-- Classpath for unit tests (superset of compile.classpath) -->
<path id="test.classpath">
<pathelement location="${build.test.classes}" />
<path refid="compile.classpath" />
</path>
</target>
<target name="ivy-probe-antlib" >
<condition property="ivy.found">
<typefound uri="antlib:org.apache.ivy.ant" name="cleancache"/>
</condition>
</target>
<target name="ivy-download" unless="offline">
<mkdir dir="${lib.dir}" />
<get src="${ivy_repo_url}" dest="${ivy.jar}" usetimestamp="true"/>
</target>
<target name="ivy-init-antlib" depends="ivy-download,ivy-probe-antlib"
unless="ivy.found">
<typedef uri="antlib:org.apache.ivy.ant" onerror="fail"
loaderRef="ivyLoader">
<classpath>
<pathelement location="${ivy.jar}"/>
</classpath>
</typedef>
<fail >
<condition >
<not>
<typefound uri="antlib:org.apache.ivy.ant" name="cleancache"/>
</not>
</condition>
You need Apache Ivy 2.0 or later from http://ant.apache.org/
It could not be loaded from ${ivy_repo_url}
</fail>
</target>
<target name="ivy-init" depends="ivy-init-antlib" unless="ivy.configured">
<ivy:configure settingsid="${name}.ivy.settings" file="${ivysettings.xml}"/>
<property name="ivy.configured" value="true" />
</target>
<!-- ======================================
Section: Resolving and Retrieving
====================================== -->
<target name="ivy-resolve" depends="ivy-init">
<ivy:resolve settingsRef="${name}.ivy.settings" conf="common" />
</target>
<target name="ivy-retrieve" depends="ivy-resolve">
<ivy:retrieve settingsRef="${name}.ivy.settings" conf="common"
pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}" sync="true" />
<ivy:cachepath pathid="${name}.common.classpath" conf="common" />
</target>
<!-- retrieve ivy-managed artifacts for checkstyle -->
<target name="ivy-resolve-checkstyle" depends="ivy-init">
<ivy:resolve settingsRef="${name}.ivy.settings" conf="checkstyle" />
</target>
<target name="ivy-retrieve-checkstyle" depends="ivy-resolve-checkstyle">
<ivy:retrieve settingsRef="${name}.ivy.settings"
pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}" sync="true" />
<ivy:cachepath pathid="${name}.checkstyle.classpath" conf="checkstyle" />
</target>
<!-- retrieve ivy-managed artifacts for checkstyle -->
<target name="ivy-resolve-findbugs" depends="ivy-init">
<ivy:resolve settingsRef="${name}.ivy.settings" conf="findbugs" />
</target>
<target name="ivy-retrieve-findbugs" depends="ivy-resolve-findbugs">
<ivy:retrieve settingsRef="${name}.ivy.settings"
pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}" sync="true" />
<ivy:cachepath pathid="${name}.findbugs.classpath" conf="findbugs" />
</target>
<!-- ======================================
Section: Testing and Reporting
====================================== -->
<target name="report" depends="ivy-retrieve"
description="Generates a report of dependencies">
<ivy:report todir="${build.dir}"/>
</target>
<target name="test" depends="compile, compile-test"
description="Run Spymemcached unit tests">
<echo>IPV4 address ${server.address_v4}</echo>
<echo>IPV6 address ${server.address_v6}</echo>
<echo>Port Number ${server.port_number}</echo>
<echo>Test Type(unit|ci) ${test.type}</echo>
<delete dir="${junit.dir}"/>
<mkdir dir="${junit.dir}/data"/>
<junit fork="yes" timeout="60000" failureproperty="junit.failure">
<batchtest todir="${junit.dir}/data" fork="yes">
<fileset dir="${test.dir}">
<include name="**/*Test.java"/>
</fileset>
<formatter type="xml"/>
</batchtest>
<jvmarg value="-ea" />
<sysproperty key="server.address_v4" value="${server.address_v4}"/>
<sysproperty key="server.address_v6" value="${server.address_v6}"/>
<sysproperty key="server.port_number" value="${server.port_number}"/>
<sysproperty key="test.type" value="${test.type}"/>
<formatter type="plain" usefile="false" />
<classpath refid="test.classpath" />
</junit>
<mkdir dir="${junit.dir}/tmp"/>
<junitreport todir="${junit.dir}/tmp">
<fileset dir="${junit.dir}/data"/>
<report todir="${junit.dir}"/>
</junitreport>
<delete dir="${junit.dir}/tmp"/>
<fail if="junit.failure" message="Unit test(s) failed. See reports!"/>
</target>
<target name="junitreport">
<mkdir dir="${junit.out.dir.html}"/>
<junitreport todir="${junit.out.dir.html}">
<fileset dir="${junit.out.dir.xml}">
<include name="*.xml"/>
</fileset>
<report format="frames" todir="${junit.out.dir.html}"/>
</junitreport>
</target>
<target name="compile-test" depends="compile"
description="Compile test classes">
<mkdir dir="${build.test.classes}" />
<javac
encoding="${build.encoding}"
srcdir="${test.dir}"
includes="**/*.java"
destdir="${build.test.classes}"
debug="${javac.debug}"
includeantruntime="false"
target="1.6"
source="1.6">
<classpath>
<path refid="test.classpath"/>
</classpath>
</javac>
</target>
<!-- =======================================
Section: Documentation Generation
======================================= -->
<target name="javadoc-uptodate" depends="init">
<uptodate property="javadoc.is.uptodate">
<srcfiles dir="${src.dir}">
<include name="**/*.java" />
<include name="**/*.html" />
</srcfiles>
<srcfiles dir="${test.dir}">
<include name="**/*.java" />
<include name="**/*.html" />
</srcfiles>
<mapper type="merge" to="${build.javadoc}/index.html" />
</uptodate>
</target>
<target name="docs" description="Build javadoc"
depends="init,javadoc-uptodate,compile" >
<mkdir dir="${build.javadoc}" />
<mkdir dir="${build.javadoc.test}" />
<exec executable="date" outputproperty="year">
<arg value="+%Y" />
</exec>
<javadoc
packagenames="src"
sourcepath="${src.dir}"
destdir="${build.javadoc}"
author="true"
version="true"
use="true"
windowtitle="${name} ${version} API"
doctitle="${name} ${version} API"
bottom="Copyright &copy; 2006-2009 Dustin Sallings, 2009-2013 Couchbase, Inc.">
<packageset dir="${src.dir}">
<include name="**" />
</packageset>
<classpath>
<path refid="${name}.common.classpath" />
</classpath>
</javadoc>
<javadoc
packagenames="src"
sourcepath="${test.dir}"
destdir="${build.javadoc.test}"
author="true"
version="true"
use="true"
windowtitle="${name}-test ${version} API"
doctitle="${name}-test ${version} API"
bottom="Copyright &copy; 2006-2009 Dustin Sallings, 2009-2013 Couchbase, Inc.">
<packageset dir="${test.dir}">
<include name="**" />
</packageset>
<classpath refid="test.classpath" />
</javadoc>
</target>
<target name="docsjar" depends="docs"
description="Create the documentation jar">
<mkdir dir="${build.dir}/javadocs" />
<zip destfile="${build.dir}/javadocs/${name}-${version}.jar"
basedir="${build.javadoc}" />
<zip destfile="${build.dir}/javadocs/${name}-test-${version}.jar"
basedir="${build.javadoc.test}" />
</target>
<!-- =======================================
Section: Compiling and Packaging
======================================= -->
<target name="gen-version" depends="init">
<exec executable="git" resultproperty="err" outputproperty="result">
<arg value="describe" />
<arg value="--abbrev=0" />
</exec>
<if>
<equals arg1="${err}" arg2="0"/>
<then>
<var name="version" value="${result}"/>
</then>
</if>
<exec executable="${script.src.dir}/write-version-info.sh"
dir="${basedir}" failonerror="true">
<arg value="${build.dir}" />
<arg value="${version}" />
<arg value="${git.hash}" />
</exec>
</target>
<target name="compile" depends="ivy-init, gen-version, ivy-retrieve"
description="Compile and run the project">
<mkdir dir="${build.classes}" />
<javac
encoding="${build.encoding}"
srcdir="${src.dir}"
includes="**/*.java"
destdir="${build.classes}"
debug="${javac.debug}"
deprecation="${javac.deprecation}"
includeantruntime="false"
target="1.6"
source="1.6">
<classpath refid="${name}.common.classpath" />
</javac>
<javac
encoding="${build.encoding}"
srcdir="${build.src.dir}"
includes="**/*.java"
destdir="${build.classes}"
debug="${javac.debug}"
deprecation="${javac.deprecation}"
includeantruntime="false"
target="1.6"
source="1.6">
<classpath refid="${name}.common.classpath"/>
</javac>
<move file="${build.src.dir}/net/spy/memcached/changelog.txt"
tofile="${build.classes}/net/spy/memcached/changelog.txt" />
</target>
<target name="srcjar" depends="init,jar"
description="Create source jars">
<mkdir dir="${build.dir}/sources" />
<jar jarfile="${build.dir}/sources/${name}-${version}.jar">
<fileset dir="${src.dir}" />
<fileset dir="${build.src.dir}" />
</jar>
<jar jarfile="${build.dir}/sources/${name}-test-${version}.jar">
<fileset dir="${test.dir}" />
</jar>
</target>
<target name="jar" depends="compile,compile-test" description="Creates a jar file for the library">
<mkdir dir="${build.dir}/jars" />
<jar jarfile="${build.dir}/jars/${name}-${version}.jar" basedir="${build.classes}">
<manifest>
<attribute name="Implementation-Title" value="java memcached client" />
<attribute name="Implementation-Version" value="${version}" />
<attribute name="Implementation-Vendor" value="${copyright}" />
<attribute name="Copyright" value="${copyright}" />
<attribute name="Main-Class" value="net.spy.memcached.BuildInfo" />
</manifest>
</jar>
<jar jarfile="${build.dir}/jars/${name}-test-${version}.jar" basedir="${build.test.classes}"/>
</target>
<target name="package" depends="jar,srcjar,docsjar"
description="Packages files for distribution"/>
<!-- ======================================
Section: Checkstyle Integration
====================================== -->
<target name="checkstyle" depends="ivy-retrieve-checkstyle, compile"
description="Check source code conventions">
<taskdef resource="checkstyletask.properties">
<classpath refid="${name}.checkstyle.classpath" />
</taskdef>
<mkdir dir="${checkstyle.report.dir}" />
<checkstyle config="${checkstyle.xml}" failOnViolation="false">
<fileset dir="${base.src.dir}" includes="**/*.java" />
<classpath refid="test.classpath"/>
<formatter type="xml"
toFile="${checkstyle.report.dir}/checkstyle-errors.xml" />
</checkstyle>
<xslt style="${checkstyle.format.xsl}"
in="${checkstyle.report.dir}/checkstyle-errors.xml"
out="${checkstyle.report.dir}/checkstyle-errors.html" />
</target>
<!-- ======================================
Section: Maven Support
====================================== -->
<target name="mvn-download" unless="offline">
<mkdir dir="${build.dir}" />
<get src="${mvn_repo_url}" dest="${mvn.jar}" usetimestamp="true" />
</target>
<target name="mvn-prep" depends="ivy-init, gen-version, mvn-download"
description="Creates maven files">
<!-- prepare for mvn tasks. -->
<property name="spymemcached.pom" value="${mvn.build.dir}/poms/spymemcached-${version}.pom" />
<property name="spymemcached-test.pom" value="${mvn.build.dir}/poms/spymemcached-test-${version}.pom" />
<!-- Register mvn tasks -->
<path id="mvn-ant-task.classpath" path="${mvn.jar}" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="urn:maven-artifact-ant"
classpathref="mvn-ant-task.classpath"/>
<!-- generate our poms from our ivy files. -->
<mkdir dir="${mvn.build.dir}/poms" />
<ivy:makepom ivyfile="ivy/spymemcached.xml"
pomfile="${spymemcached.pom}"
templatefile="ivy/pom.template.xml"
settingsRef="${name}.ivy.settings">
<mapping conf="default" scope="compile" />
<mapping conf="runtime" scope="runtime" />
<dependency group="log4j" artifact="log4j" version="${log4j.version}" optional="true" />
<dependency group="org.slf4j" artifact="slf4j-api" version="${slf4j.version}" optional="true" />
<dependency group="org.springframework" artifact="spring-beans" version="${spring-beans.version}" optional="true" />
<dependency group="com.codahale.metrics" artifact="metrics-core" version="${codahale.metrics.version}" optional="true" />
</ivy:makepom>
<ivy:makepom ivyfile="ivy/spymemcached-test.xml"
pomfile="${spymemcached-test.pom}"
templatefile="ivy/pom.template.xml"
settingsRef="${name}.ivy.settings">
<mapping conf="default" scope="compile" />
<mapping conf="runtime" scope="runtime" />
<dependency group="log4j" artifact="log4j" version="${log4j.version}" optional="true" />
<dependency group="org.slf4j" artifact="slf4j-api" version="${slf4j.version}" optional="true" />
<dependency group="org.springframework" artifact="spring-beans" version="${spring-beans.version}" optional="true" />
<dependency group="com.codahale.metrics" artifact="metrics-core" version="${codahale.metrics.version}" />
</ivy:makepom>
<!-- Change the version in the pom file to reflect our claimed version. -->
<replaceregexp>
<regexp pattern="<version>.*</version>" />
<substitution expression="<version>${version}</version>" />
<fileset dir="${mvn.build.dir}/poms">
<include name="*.pom" />
</fileset>
</replaceregexp>
</target>
<target name="mvn-install" depends="jar,srcjar,package,mvn-prep"
description="Install Spymemcached in local m2 repository">
<!-- @todo: change to use ivy publish -->
<artifact:pom id="spymemcached" file="${spymemcached.pom}" />
<artifact:install file="${build.dir}/jars/${name}-${version}.jar">
<pom refid="${name}" />
<attach file="${build.dir}/sources/${name}-${version}.jar"
classifier="sources" />
<attach file="${build.dir}/javadocs/${name}-${version}.jar"
classifier="javadoc" />
</artifact:install>
<artifact:pom id="spymemcached-test" file="${spymemcached-test.pom}" />
<artifact:install file="${build.dir}/jars/${name}-test-${version}.jar">
<pom refid="${name}-test" />
<attach file="${build.dir}/sources/${name}-test-${version}.jar"
classifier="sources" />
<attach file="${build.dir}/javadocs/${name}-test-${version}.jar"
classifier="javadoc" />
</artifact:install>
</target>
<target name="mvn-deploy" depends="mvn-install" description="deploy snapshot version to maven snapshot repository">
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file" />
<arg value="-Durl=${maven-snapshots-repository-url}" />
<arg value="-DrepositoryId=${maven-snapshots-repository-id}" />
<arg value="-DpomFile=${spymemcached.pom}" />
<arg value="-Dfile=${build.dir}/jars/${name}-${version}.jar" />
</artifact:mvn>
</target>
<target name="mvn-stage" depends="mvn-install" description="deploy release version to maven staging repository">
<!-- sign and deploy the main artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=${spymemcached.pom}" />
<arg value="-Dfile=${build.dir}/jars/${name}-${version}.jar" />
<arg value="-Pgpg" />
</artifact:mvn>
<!-- sign and deploy the sources artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=${spymemcached.pom}" />
<arg value="-Dfile=${build.dir}/sources/${name}-${version}.jar" />
<arg value="-Dclassifier=sources" />
<arg value="-Pgpg" />
</artifact:mvn>
<!-- sign and deploy the javadoc artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=${spymemcached.pom}" />
<arg value="-Dfile=${build.dir}/javadocs/${name}-${version}.jar" />
<arg value="-Dclassifier=javadoc" />
<arg value="-Pgpg" />
</artifact:mvn>
<!-- sign and deploy the main artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=${spymemcached-test.pom}" />
<arg value="-Dfile=${build.dir}/jars/${name}-test-${version}.jar" />
<arg value="-Pgpg" />
</artifact:mvn>
<!-- sign and deploy the sources artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=${spymemcached-test.pom}" />
<arg value="-Dfile=${build.dir}/sources/${name}-test-${version}.jar" />
<arg value="-Dclassifier=sources" />
<arg value="-Pgpg" />
</artifact:mvn>
<!-- sign and deploy the javadoc artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=${spymemcached-test.pom}" />
<arg value="-Dfile=${build.dir}/javadocs/${name}-test-${version}.jar" />
<arg value="-Dclassifier=javadoc" />
<arg value="-Pgpg" />
</artifact:mvn>
</target>
<!-- ======================================
Section: Stage Maven locally
====================================== -->
<target name="mvn-stage-local" depends="package,ivy-init,mvn-prep" description="publish jar/source to maven repo mounted at ~/mvn-stage">
<ivy:publish resolver="share-m2" forcedeliver="true" overwrite="true" publishivy="false">
<artifacts pattern="build/[type]s/[artifact]-[revision].[ext]" />
</ivy:publish>
</target>
<!-- ======================================
Section: Findbugs Integration
====================================== -->
<target name="findbugs" depends="check-for-findbugs, jar"
description="Run FindBugs">
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
classpath="${findbugs.home}/lib/findbugs-ant.jar" />
<mkdir dir="${findbugs.out.dir}"/>
<findbugs home="${findbugs.home}" output="xml:withMessages"
outputFile="${findbugs.output.xml.file}" effort="max"
jvmargs="-Xms512m -Xmx512m">
<auxClasspath>
<path refid="${name}.common.classpath"/>
</auxClasspath>
<sourcePath path="${src.dir}" />
<sourcePath path="${test.dir}" />
<class location="${build.dir}/${dest.jar}" />
</findbugs>
<xslt style="${findbugs.home}/src/xsl/default.xsl"
in="${findbugs.output.xml.file}"
out="${findbugs.output.html.file}" />
</target>
<target name="warn-findbugs-unset" unless="findbugs.home">
<fail message="You need to set -Dfindbugs.home=/path/to/findbugs" />
</target>
<target name="check-for-findbugs" depends="warn-findbugs-unset">
<available property="findbugs.present"
file="${findbugs.home}/lib/findbugs.jar" />
</target>
<!-- ======================================
Section: IDE Integration
====================================== -->
<target name="eclipse" description="Generate Eclipse project"
depends="init, ivy-retrieve">
<taskdef name="eclipse" classname="prantl.ant.eclipse.EclipseTask"
classpath="${lib.dir}/ant-eclipse-1.0-jvm1.2.jar" />
<eclipse failonerror="true" updatealways="true">
<project name="${name}" />
<classpath>
<source path="${src.dir}" />
<source path="${test.dir}" />
<output path="${build.dir}/eclipse-build" />
<library pathref="${name}.common.classpath" />
</classpath>
</eclipse>
</target>
<!-- =================================
Section: Cleaning
================================= -->
<target name="clean" description="Clean the project">
<delete includeemptydirs="true">
<fileset dir="${basedir}">
<exclude name="src/**" />
<exclude name="ivy/**" />
<exclude name="etc/**" />
<exclude name="lib/ant*" />
<exclude name="xdocs/**" />
<exclude name="build.xml" />
<exclude name="config.properties" />
<exclude name="ivy.xml" />
<exclude name="LICENSE.txt" />
<exclude name="README.markdown" />
<exclude name=".gitreview" />
<exclude name=".git/**" />
<exclude name=".idea/**" />
<exclude name="pom.xml" />
</fileset>
</delete>
</target>
</project>