-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
1047 lines (925 loc) · 47 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
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="${name}" default="runtime" xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<!-- Load all the default properties, and any the user wants -->
<!-- to contribute (without having to type -D or edit this file -->
<property file="${user.home}/build.properties" />
<property file="${basedir}/build.properties" />
<property file="${basedir}/default.properties" />
<property name="test.junit.output.format" value="plain"/>
<property name="release.dir" value="${build.dir}/release"/>
<!-- define Maven coordinates, repository url and artifacts name etc -->
<property name="groupId" value="org.apache.nutch" />
<property name="artifactId" value="nutch" />
<property name="maven-repository-url" value="https://repository.apache.org/service/local/staging/deploy/maven2" />
<property name="maven-repository-id" value="apache.releases.https" />
<property name="maven-jar" value="${release.dir}/${artifactId}-${version}.jar" />
<property name="maven-javadoc-jar" value="${release.dir}/${artifactId}-${version}-javadoc.jar" />
<property name="maven-sources-jar" value="${release.dir}/${artifactId}-${version}-sources.jar" />
<!-- the normal classpath -->
<path id="classpath">
<pathelement location="${build.classes}"/>
<fileset dir="${build.lib.dir}">
<include name="*.jar" />
</fileset>
</path>
<dirname property="plugins.classpath.dir" file="${build.plugins}"/>
<!-- the unit test classpath -->
<path id="test.classpath">
<pathelement location="${test.build.classes}" />
<pathelement location="${conf.dir}"/>
<pathelement location="${test.src.dir}"/>
<pathelement location="${plugins.classpath.dir}"/>
<path refid="classpath"/>
<pathelement location="${build.dir}/${final.name}.job" />
<fileset dir="${build.lib.dir}">
<include name="*.jar" />
</fileset>
<fileset dir="${test.build.lib.dir}">
<include name="*.jar" />
</fileset>
</path>
<presetdef name="javac">
<javac includeantruntime="false" />
</presetdef>
<!-- ====================================================== -->
<!-- Stuff needed by all targets -->
<!-- ====================================================== -->
<target name="init" depends="ivy-init" description="--> stuff required by all targets">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.classes}"/>
<mkdir dir="${release.dir}"/>
<mkdir dir="${test.build.dir}"/>
<mkdir dir="${test.build.classes}"/>
<mkdir dir="${test.build.lib.dir}"/>
<touch datetime="01/25/1971 2:00 pm">
<fileset dir="${conf.dir}" includes="**/*.template"/>
</touch>
<copy todir="${conf.dir}" verbose="true">
<fileset dir="${conf.dir}" includes="**/*.template"/>
<mapper type="glob" from="*.template" to="*"/>
</copy>
</target>
<!-- ====================================================== -->
<!-- Compile the Java files -->
<!-- ====================================================== -->
<target name="compile" depends="compile-core, compile-plugins" description="--> compile all Java files"/>
<target name="compile-core" depends="init, resolve-default" description="--> compile core Java files only">
<javac
encoding="${build.encoding}"
srcdir="${src.dir}"
includes="org/apache/nutch/**/*.java"
destdir="${build.classes}"
debug="${javac.debug}"
optimize="${javac.optimize}"
target="${javac.version}"
source="${javac.version}"
deprecation="${javac.deprecation}">
<compilerarg value="-Xlint:-path"/>
<classpath refid="classpath"/>
</javac>
</target>
<target name="compile-plugins" depends="init, resolve-default" description="--> compile plugins only">
<ant dir="src/plugin" target="deploy" inheritAll="false"/>
</target>
<!-- ================================================================== -->
<!-- Make nutch.jar -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="jar" depends="compile-core" description="--> make nutch.jar">
<copy file="${conf.dir}/nutch-default.xml"
todir="${build.classes}"/>
<copy file="${conf.dir}/nutch-site.xml"
todir="${build.classes}"/>
<jar jarfile="${build.dir}/${final.name}.jar"
basedir="${build.classes}">
<manifest>
</manifest>
</jar>
</target>
<!-- ================================================================== -->
<!-- Make Maven Central Release -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="release" depends="compile-core" description="--> generate the release distribution">
<copy file="${conf.dir}/nutch-default.xml"
todir="${build.classes}"/>
<copy file="${conf.dir}/nutch-site.xml"
todir="${build.classes}"/>
<!-- build the main artifact -->
<jar jarfile="${maven-jar}" basedir="${build.classes}" />
<fail message="Unsupported Java version: ${java.version}. Javadoc requires Java version 7u25 or greater. See https://issues.apache.org/jira/browse/NUTCH-1590">
<condition>
<or>
<matches string="${java.version}" pattern="1.7.0_2[01234].+" casesensitive="false" />
<matches string="${java.version}" pattern="1.7.0_1.+" casesensitive="false" />
<equals arg1="${ant.java.version}" arg2="1.6" />
<equals arg1="${ant.java.version}" arg2="1.5" />
</or>
</condition>
</fail>
<!-- build the javadoc artifact -->
<javadoc
destdir="${release.dir}/javadoc"
overview="${src.dir}/overview.html"
author="true"
version="true"
use="true"
windowtitle="${name} ${version} API"
doctitle="${name} ${version} API"
bottom="Copyright &copy; ${year} The Apache Software Foundation"
>
<arg value="${javadoc.proxy.host}"/>
<arg value="${javadoc.proxy.port}"/>
<packageset dir="${src.dir}"/>
<packageset dir="${plugins.dir}/parse-rawxml/src/java"/>
<packageset dir="${plugins.dir}/index-rawxml/src/java"/>
<packageset dir="${plugins.dir}/index-xmlnamespaces/src/java"/>
<packageset dir="${plugins.dir}/index-bcubefilter/src/java"/>
<packageset dir="${plugins.dir}/creativecommons/src/java"/>
<packageset dir="${plugins.dir}/feed/src/java"/>
<packageset dir="${plugins.dir}/headings/src/java"/>
<packageset dir="${plugins.dir}/index-anchor/src/java"/>
<packageset dir="${plugins.dir}/index-basic/src/java"/>
<packageset dir="${plugins.dir}/index-metadata/src/java"/>
<packageset dir="${plugins.dir}/index-more/src/java"/>
<packageset dir="${plugins.dir}/index-static/src/java"/>
<packageset dir="${plugins.dir}/indexer-dummy/src/java"/>
<packageset dir="${plugins.dir}/indexer-elastic/src/java/" />
<packageset dir="${plugins.dir}/indexer-solr/src/java"/>
<packageset dir="${plugins.dir}/language-identifier/src/java"/>
<packageset dir="${plugins.dir}/lib-http/src/java"/>
<packageset dir="${plugins.dir}/lib-regex-filter/src/java"/>
<packageset dir="${plugins.dir}/microformats-reltag/src/java"/>
<packageset dir="${plugins.dir}/parse-ext/src/java"/>
<packageset dir="${plugins.dir}/parse-html/src/java"/>
<packageset dir="${plugins.dir}/parse-js/src/java"/>
<packageset dir="${plugins.dir}/parse-metatags/src/java"/>
<packageset dir="${plugins.dir}/parse-swf/src/java"/>
<packageset dir="${plugins.dir}/parse-tika/src/java"/>
<packageset dir="${plugins.dir}/parse-zip/src/java"/>
<packageset dir="${plugins.dir}/protocol-file/src/java"/>
<packageset dir="${plugins.dir}/protocol-ftp/src/java"/>
<packageset dir="${plugins.dir}/protocol-http/src/java"/>
<packageset dir="${plugins.dir}/protocol-httpclient/src/java"/>
<packageset dir="${plugins.dir}/scoring-depth/src/java"/>
<packageset dir="${plugins.dir}/scoring-link/src/java"/>
<packageset dir="${plugins.dir}/scoring-opic/src/java"/>
<packageset dir="${plugins.dir}/subcollection/src/java"/>
<packageset dir="${plugins.dir}/tld/src/java"/>
<packageset dir="${plugins.dir}/urlfilter-automaton/src/java"/>
<packageset dir="${plugins.dir}/urlfilter-domain/src/java"/>
<packageset dir="${plugins.dir}/urlfilter-domainblacklist/src/java"/>
<packageset dir="${plugins.dir}/urlfilter-prefix/src/java"/>
<packageset dir="${plugins.dir}/urlfilter-regex/src/java"/>
<packageset dir="${plugins.dir}/urlfilter-suffix/src/java"/>
<packageset dir="${plugins.dir}/urlfilter-validator/src/java"/>
<packageset dir="${plugins.dir}/urlmeta/src/java"/>
<packageset dir="${plugins.dir}/urlnormalizer-basic/src/java"/>
<packageset dir="${plugins.dir}/urlnormalizer-host/src/java"/>
<packageset dir="${plugins.dir}/urlnormalizer-pass/src/java"/>
<packageset dir="${plugins.dir}/urlnormalizer-querystring/src/java"/>
<packageset dir="${plugins.dir}/urlnormalizer-regex/src/java"/>
<link href="${javadoc.link.java}"/>
<link href="${javadoc.link.lucene}"/>
<link href="${javadoc.link.hadoop}"/>
<classpath refid="classpath"/>
<classpath>
<fileset dir="${plugins.dir}" >
<include name="**/*.jar"/>
</fileset>
</classpath>
<group title="Core" packages="org.apache.nutch.*"/>
<group title="Plugins API" packages="${plugins.api}"/>
<group title="Protocol Plugins" packages="${plugins.protocol}"/>
<group title="URL Filter Plugins" packages="${plugins.urlfilter}"/>
<group title="URL Normalizer Plugins" packages="${plugins.urlnormalizer}"/>
<group title="Scoring Plugins" packages="${plugins.scoring}"/>
<group title="Parse Plugins" packages="${plugins.parse}"/>
<group title="Parse Filter Plugins" packages="${plugins.parsefilter}"/>
<group title="Indexing Filter Plugins" packages="${plugins.index}"/>
<group title="Indexer Plugins" packages="${plugins.indexer}"/>
<group title="Misc. Plugins" packages="${plugins.misc}"/>
</javadoc>
<jar jarfile="${maven-javadoc-jar}">
<fileset dir="${release.dir}/javadoc" />
</jar>
<!-- build the sources artifact -->
<jar jarfile="${maven-sources-jar}">
<fileset dir="${src.dir}" />
</jar>
</target>
<!-- ================================================================== -->
<!-- Deploy to Apache Nexus -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="deploy" depends="release" description="--> deploy to Apache Nexus">
<!-- generate a pom file -->
<ivy:makepom ivyfile="${ivy.file}" pomfile="${basedir}/pom.xml" templatefile="ivy/mvn.template">
<mapping conf="default" scope="compile"/>
<mapping conf="runtime" scope="runtime"/>
</ivy:makepom>
<!-- sign and deploy the main artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.5:sign-and-deploy-file" />
<arg value="-Durl=${maven-repository-url}" />
<arg value="-DrepositoryId=${maven-repository-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${maven-jar}" />
<arg value="-Papache-release" />
</artifact:mvn>
<!-- sign and deploy the sources artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.5:sign-and-deploy-file" />
<arg value="-Durl=${maven-repository-url}" />
<arg value="-DrepositoryId=${maven-repository-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${maven-sources-jar}" />
<arg value="-Dclassifier=sources" />
<arg value="-Papache-release" />
</artifact:mvn>
<!-- sign and deploy the javadoc artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.5:sign-and-deploy-file" />
<arg value="-Durl=${maven-repository-url}" />
<arg value="-DrepositoryId=${maven-repository-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${maven-javadoc-jar}" />
<arg value="-Dclassifier=javadoc" />
<arg value="-Papache-release" />
</artifact:mvn>
</target>
<!-- ================================================================== -->
<!-- Make job jar -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="job" depends="compile" description="--> make nutch.job jar">
<jar jarfile="${build.dir}/${final.name}.job">
<!-- If the build.classes has the nutch config files because the jar
command command has run, exclude them. The conf directory has
them.
-->
<zipfileset dir="${build.classes}"
excludes="nutch-default.xml,nutch-site.xml"/>
<zipfileset dir="${conf.dir}" excludes="*.template,hadoop*.*"/>
<zipfileset dir="${build.lib.dir}" prefix="lib"
includes="**/*.jar" excludes="hadoop-*.jar,slf4j*.jar,log4j*.jar"/>
<zipfileset dir="${build.plugins}" prefix="classes/plugins"/>
</jar>
</target>
<target name="runtime" depends="jar, job" description="--> default target for running Nutch">
<mkdir dir="${runtime.dir}"/>
<mkdir dir="${runtime.local}"/>
<mkdir dir="${runtime.deploy}"/>
<!-- deploy area -->
<copy file="${build.dir}/${final.name}.job"
todir="${runtime.deploy}"/>
<copy todir="${runtime.deploy}/bin">
<fileset dir="src/bin"/>
</copy>
<chmod perm="ugo+x" type="file">
<fileset dir="${runtime.deploy}/bin"/>
</chmod>
<!-- local area -->
<copy file="${build.dir}/${final.name}.jar"
todir="${runtime.local}/lib"/>
<copy todir="${runtime.local}/lib/native">
<fileset dir="lib/native"/>
</copy>
<copy todir="${runtime.local}/conf">
<fileset dir="${conf.dir}" excludes="*.template"/>
</copy>
<copy todir="${runtime.local}/bin">
<fileset dir="src/bin"/>
</copy>
<chmod perm="ugo+x" type="file">
<fileset dir="${runtime.local}/bin"/>
</chmod>
<copy todir="${runtime.local}/lib">
<fileset dir="${build.dir}/lib"/>
</copy>
<copy todir="${runtime.local}/plugins">
<fileset dir="${build.dir}/plugins"/>
</copy>
<copy todir="${runtime.local}/test">
<fileset dir="${build.dir}/test"/>
</copy>
</target>
<!-- ================================================================== -->
<!-- Compile test code -->
<!-- ================================================================== -->
<target name="compile-core-test" depends="init, resolve-test, compile-core" description="--> compile test code">
<javac
encoding="${build.encoding}"
srcdir="${test.src.dir}"
includes="org/apache/nutch/**/*.java"
destdir="${test.build.classes}"
debug="${javac.debug}"
optimize="${javac.optimize}"
target="${javac.version}"
source="${javac.version}"
deprecation="${javac.deprecation}">
<compilerarg value="-Xlint:-path"/>
<classpath refid="test.classpath"/>
</javac>
</target>
<!-- ================================================================== -->
<!-- Run Nutch proxy -->
<!-- ================================================================== -->
<target name="proxy" depends="compile-core-test, job" description="--> run nutch proxy">
<java classname="org.apache.nutch.tools.proxy.ProxyTestbed" fork="true">
<classpath refid="test.classpath"/>
<arg value="-fake"/>
<!--
<arg value="-delay"/>
<arg value="-200"/>
-->
<jvmarg line="-Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"/>
</java>
</target>
<!-- ================================================================== -->
<!-- Run Nutch benchmarking analysis -->
<!-- ================================================================== -->
<target name="benchmark" description="--> run nutch benchmarking analysis">
<java classname="org.apache.nutch.tools.Benchmark" fork="true">
<classpath refid="test.classpath"/>
<jvmarg line="-Xmx512m -Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"/>
<arg value="-maxPerHost"/>
<arg value="10"/>
<arg value="-seeds"/>
<arg value="1"/>
<arg value="-depth"/>
<arg value="5"/>
</java>
</target>
<!-- ================================================================== -->
<!-- Run unit tests -->
<!-- ================================================================== -->
<target name="test" depends="test-core, test-plugins" description="--> run JUnit tests"/>
<target name="test-core" depends="compile-core-test, job" description="--> run core JUnit tests only">
<delete dir="${test.build.data}"/>
<mkdir dir="${test.build.data}"/>
<!--
copy resources needed in junit tests
-->
<copy todir="${test.build.data}">
<fileset dir="src/testresources" includes="**/*"/>
</copy>
<copy file="${test.src.dir}/nutch-site.xml"
todir="${test.build.classes}"/>
<copy file="${test.src.dir}/log4j.properties"
todir="${test.build.classes}"/>
<copy file="${test.src.dir}/crawl-tests.xml"
todir="${test.build.classes}"/>
<copy file="${test.src.dir}/domain-urlfilter.txt"
todir="${test.build.classes}"/>
<copy file="${test.src.dir}/filter-all.txt"
todir="${test.build.classes}"/>
<junit printsummary="yes" haltonfailure="no" fork="yes" dir="${basedir}"
errorProperty="tests.failed" failureProperty="tests.failed" maxmemory="1000m">
<sysproperty key="test.build.data" value="${test.build.data}"/>
<sysproperty key="test.src.dir" value="${test.src.dir}"/>
<sysproperty key="javax.xml.parsers.DocumentBuilderFactory" value="com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"/>
<classpath refid="test.classpath"/>
<formatter type="${test.junit.output.format}" />
<batchtest todir="${test.build.dir}" unless="testcase">
<fileset dir="${test.src.dir}"
includes="**/Test*.java" excludes="**/${test.exclude}.java" />
</batchtest>
<batchtest todir="${test.build.dir}" if="testcase">
<fileset dir="${test.src.dir}" includes="**/${testcase}.java"/>
</batchtest>
</junit>
<fail if="tests.failed">Tests failed!</fail>
</target>
<target name="test-plugins" depends="resolve-test, compile" description="--> run plugin JUnit tests only">
<ant dir="src/plugin" target="test" inheritAll="false"/>
</target>
<target name="nightly" depends="test, tar-src, zip-src" description="--> run the nightly target build">
</target>
<!-- ================================================================== -->
<!-- Ivy targets -->
<!-- ================================================================== -->
<!-- target: resolve ================================================= -->
<target name="resolve-default" depends="clean-lib" description="--> resolve and retrieve dependencies with ivy">
<ivy:resolve file="${ivy.file}" conf="default" log="download-only"/>
<ivy:retrieve pattern="${build.lib.dir}/[artifact]-[revision].[ext]" symlink="false" log="quiet"/>
<antcall target="copy-libs"/>
</target>
<target name="resolve-test" depends="clean-lib, init" description="--> resolve and retrieve dependencies with ivy">
<ivy:resolve file="${ivy.file}" conf="test" log="download-only"/>
<ivy:retrieve pattern="${test.build.lib.dir}/[artifact]-[revision].[ext]" symlink="false" log="quiet"/>
<antcall target="copy-libs"/>
</target>
<target name="copy-libs" description="--> copy the libs in lib, which are not ivy enabled">
<!-- copy the libs in lib, which are not ivy enabled-->
<copy todir="${build.lib.dir}/" failonerror="false">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</copy>
</target>
<!-- target: publish-local =========================================== -->
<target name="publish-local" depends="jar" description="--> publish this project in the local ivy repository">
<ivy:publish artifactspattern="${build.dir}/[artifact]-${version}.[ext]"
resolver="local"
pubrevision="${version}"
pubdate="${now}"
status="integration"
forcedeliver="true"
overwrite="true"
/>
<echo message="project ${ant.project.name} published locally with version ${version}" />
</target>
<!-- target: report ================================================== -->
<target name="report" depends="resolve-test" description="--> generates a report of dependencies">
<ivy:report todir="${build.dir}"/>
</target>
<!-- target: ivy-init ================================================ -->
<target name="ivy-init" depends="ivy-probe-antlib, ivy-init-antlib" description="--> initialise Ivy settings">
<ivy:settings file="${ivy.dir}/ivysettings.xml" />
</target>
<!-- target: ivy-probe-antlib ======================================== -->
<target name="ivy-probe-antlib" description="--> probe the antlib library">
<condition property="ivy.found">
<typefound uri="antlib:org.apache.ivy.ant" name="cleancache" />
</condition>
</target>
<!-- target: ivy-download ============================================ -->
<target name="ivy-download" description="--> download ivy">
<available file="${ivy.jar}" property="ivy.jar.found"/>
<antcall target="ivy-download-unchecked"/>
</target>
<!-- target: ivy-download-unchecked ================================== -->
<target name="ivy-download-unchecked" unless="ivy.jar.found" description="--> fetch any ivy file">
<get src="${ivy.repo.url}" dest="${ivy.jar}" usetimestamp="true" />
</target>
<!-- target: ivy-init-antlib ========================================= -->
<target name="ivy-init-antlib" depends="ivy-download" unless="ivy.found" description="--> attempt to use Ivy with Antlib">
<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>
<!-- ================================================================== -->
<!-- Documentation -->
<!-- ================================================================== -->
<target name="javadoc" depends="compile" description="--> generate Javadoc">
<fail message="Unsupported Java version: ${java.version}. Javadoc requires Java version 7u25 or greater. See https://issues.apache.org/jira/browse/NUTCH-1590">
<condition>
<or>
<matches string="${java.version}" pattern="1.7.0_2[01234].+" casesensitive="false" />
<matches string="${java.version}" pattern="1.7.0_1.+" casesensitive="false" />
<equals arg1="${ant.java.version}" arg2="1.6" />
<equals arg1="${ant.java.version}" arg2="1.5" />
</or>
</condition>
</fail>
<mkdir dir="${build.javadoc}"/>
<javadoc
overview="${src.dir}/overview.html"
destdir="${build.javadoc}"
author="true"
version="true"
use="true"
windowtitle="${name} ${version} API"
doctitle="${name} ${version} API"
bottom="Copyright &copy; ${year} The Apache Software Foundation"
>
<arg value="${javadoc.proxy.host}"/>
<arg value="${javadoc.proxy.port}"/>
<packageset dir="${src.dir}"/>
<packageset dir="${plugins.dir}/parse-rawxml/src/java"/>
<packageset dir="${plugins.dir}/index-rawxml/src/java"/>
<packageset dir="${plugins.dir}/index-xmlnamespaces/src/java"/>
<packageset dir="${plugins.dir}/index-bcubefilter/src/java"/>
<packageset dir="${plugins.dir}/creativecommons/src/java"/>
<packageset dir="${plugins.dir}/feed/src/java"/>
<packageset dir="${plugins.dir}/headings/src/java"/>
<packageset dir="${plugins.dir}/index-anchor/src/java"/>
<packageset dir="${plugins.dir}/index-basic/src/java"/>
<packageset dir="${plugins.dir}/index-metadata/src/java"/>
<packageset dir="${plugins.dir}/index-more/src/java"/>
<packageset dir="${plugins.dir}/index-static/src/java"/>
<packageset dir="${plugins.dir}/indexer-dummy/src/java"/>
<packageset dir="${plugins.dir}/indexer-elastic/src/java/" />
<packageset dir="${plugins.dir}/indexer-solr/src/java"/>
<packageset dir="${plugins.dir}/language-identifier/src/java"/>
<packageset dir="${plugins.dir}/lib-http/src/java"/>
<packageset dir="${plugins.dir}/lib-regex-filter/src/java"/>
<packageset dir="${plugins.dir}/microformats-reltag/src/java"/>
<packageset dir="${plugins.dir}/parse-ext/src/java"/>
<packageset dir="${plugins.dir}/parse-html/src/java"/>
<packageset dir="${plugins.dir}/parse-js/src/java"/>
<packageset dir="${plugins.dir}/parse-metatags/src/java"/>
<packageset dir="${plugins.dir}/parse-swf/src/java"/>
<packageset dir="${plugins.dir}/parse-tika/src/java"/>
<packageset dir="${plugins.dir}/parse-zip/src/java"/>
<packageset dir="${plugins.dir}/protocol-file/src/java"/>
<packageset dir="${plugins.dir}/protocol-ftp/src/java"/>
<packageset dir="${plugins.dir}/protocol-http/src/java"/>
<packageset dir="${plugins.dir}/protocol-httpclient/src/java"/>
<packageset dir="${plugins.dir}/scoring-depth/src/java"/>
<packageset dir="${plugins.dir}/scoring-link/src/java"/>
<packageset dir="${plugins.dir}/scoring-opic/src/java"/>
<packageset dir="${plugins.dir}/subcollection/src/java"/>
<packageset dir="${plugins.dir}/tld/src/java"/>
<packageset dir="${plugins.dir}/urlfilter-automaton/src/java"/>
<packageset dir="${plugins.dir}/urlfilter-domain/src/java"/>
<packageset dir="${plugins.dir}/urlfilter-domainblacklist/src/java"/>
<packageset dir="${plugins.dir}/urlfilter-prefix/src/java"/>
<packageset dir="${plugins.dir}/urlfilter-regex/src/java"/>
<packageset dir="${plugins.dir}/urlfilter-suffix/src/java"/>
<packageset dir="${plugins.dir}/urlfilter-validator/src/java"/>
<packageset dir="${plugins.dir}/urlmeta/src/java"/>
<packageset dir="${plugins.dir}/urlnormalizer-basic/src/java"/>
<packageset dir="${plugins.dir}/urlnormalizer-host/src/java"/>
<packageset dir="${plugins.dir}/urlnormalizer-pass/src/java"/>
<packageset dir="${plugins.dir}/urlnormalizer-querystring/src/java"/>
<packageset dir="${plugins.dir}/urlnormalizer-regex/src/java"/>
<link href="${javadoc.link.java}"/>
<link href="${javadoc.link.lucene}"/>
<link href="${javadoc.link.hadoop}"/>
<classpath refid="classpath"/>
<classpath>
<fileset dir="${plugins.dir}" >
<include name="**/*.jar"/>
</fileset>
</classpath>
<group title="Core" packages="org.apache.nutch.*"/>
<group title="Plugins API" packages="${plugins.api}"/>
<group title="Protocol Plugins" packages="${plugins.protocol}"/>
<group title="URL Filter Plugins" packages="${plugins.urlfilter}"/>
<group title="URL Normalizer Plugins" packages="${plugins.urlnormalizer}"/>
<group title="Scoring Plugins" packages="${plugins.scoring}"/>
<group title="Parse Plugins" packages="${plugins.parse}"/>
<group title="Parse Filter Plugins" packages="${plugins.parsefilter}"/>
<group title="Indexing Filter Plugins" packages="${plugins.index}"/>
<group title="Indexer Plugins" packages="${plugins.indexer}"/>
<group title="Misc. Plugins" packages="${plugins.misc}"/>
</javadoc>
<!-- Copy the plugin.dtd file to the plugin doc-files dir -->
<copy file="${plugins.dir}/plugin.dtd"
todir="${build.javadoc}/org/apache/nutch/plugin/doc-files"/>
</target>
<target name="default-doc" description="--> generate default Nutch documentation">
<style basedir="${conf.dir}" destdir="${docs.dir}"
includes="nutch-default.xml" style="conf/nutch-conf.xsl"/>
</target>
<!-- ================================================================== -->
<!-- D I S T R I B U T I O N -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="package-src" depends="runtime, javadoc" description="--> generate source distribution package">
<mkdir dir="${dist.dir}"/>
<mkdir dir="${src.dist.version.dir}"/>
<mkdir dir="${src.dist.version.dir}/lib"/>
<mkdir dir="${src.dist.version.dir}/docs"/>
<mkdir dir="${src.dist.version.dir}/docs/api"/>
<mkdir dir="${src.dist.version.dir}/ivy"/>
<copy todir="${src.dist.version.dir}/lib" includeEmptyDirs="false">
<fileset dir="lib"/>
</copy>
<copy todir="${src.dist.version.dir}/conf">
<fileset dir="${conf.dir}" excludes="**/*.template"/>
</copy>
<copy todir="${src.dist.version.dir}/docs/api">
<fileset dir="${build.javadoc}"/>
</copy>
<copy todir="${src.dist.version.dir}">
<fileset dir=".">
<include name="*.txt" />
<!--<include name="KEYS" />-->
</fileset>
</copy>
<copy todir="${src.dist.version.dir}/src" includeEmptyDirs="true">
<fileset dir="src"/>
</copy>
<copy todir="${src.dist.version.dir}/ivy" includeEmptyDirs="true">
<fileset dir="ivy"/>
</copy>
<copy todir="${src.dist.version.dir}/" file="build.xml"/>
<copy todir="${src.dist.version.dir}/" file="default.properties"/>
</target>
<target name="package-bin" depends="runtime, javadoc" description="--> generate binary distribution package">
<mkdir dir="${dist.dir}"/>
<mkdir dir="${bin.dist.version.dir}"/>
<mkdir dir="${bin.dist.version.dir}/lib"/>
<mkdir dir="${bin.dist.version.dir}/bin"/>
<mkdir dir="${bin.dist.version.dir}/conf"/>
<mkdir dir="${bin.dist.version.dir}/docs"/>
<mkdir dir="${bin.dist.version.dir}/docs/api"/>
<mkdir dir="${bin.dist.version.dir}/plugins"/>
<copy todir="${bin.dist.version.dir}/lib" includeEmptyDirs="false">
<fileset dir="runtime/local/lib"/>
</copy>
<copy todir="${bin.dist.version.dir}/bin">
<fileset dir="runtime/local/bin"/>
</copy>
<chmod perm="ugo+x" type="file">
<fileset dir="${bin.dist.version.dir}/bin"/>
</chmod>
<copy todir="${bin.dist.version.dir}/conf">
<fileset dir="runtime/local/conf" excludes="**/*.template"/>
</copy>
<copy todir="${bin.dist.version.dir}/docs/api">
<fileset dir="${build.javadoc}"/>
</copy>
<copy todir="${bin.dist.version.dir}">
<fileset dir=".">
<include name="*.txt" />
</fileset>
</copy>
<copy todir="${bin.dist.version.dir}/plugins" includeEmptyDirs="true">
<fileset dir="runtime/local/plugins"/>
</copy>
</target>
<!-- ================================================================== -->
<!-- Make src release tarball -->
<!-- ================================================================== -->
<target name="tar-src" depends="package-src" description="--> generate src.tar.gz distribution package">
<tar compression="gzip" longfile="gnu"
destfile="${src.dist.version.dir}.tar.gz">
<tarfileset dir="${src.dist.version.dir}" mode="664" prefix="${final.name}">
<exclude name="src/bin/*" />
<include name="**" />
</tarfileset>
<tarfileset dir="${src.dist.version.dir}" mode="755" prefix="${final.name}">
<include name="src/bin/*" />
</tarfileset>
</tar>
</target>
<!-- ================================================================== -->
<!-- Make bin release tarball -->
<!-- ================================================================== -->
<target name="tar-bin" depends="package-bin" description="--> generate bin.tar.gz distribution package">
<tar compression="gzip" longfile="gnu"
destfile="${bin.dist.version.dir}.tar.gz">
<tarfileset dir="${bin.dist.version.dir}" mode="664" prefix="${final.name}">
<exclude name="bin/*" />
<include name="**" />
</tarfileset>
<tarfileset dir="${bin.dist.version.dir}" mode="755" prefix="${final.name}">
<include name="bin/*" />
</tarfileset>
</tar>
</target>
<!-- ================================================================== -->
<!-- Make src release zip -->
<!-- ================================================================== -->
<target name="zip-src" depends="package-src" description="--> generate src.zip distribution package">
<zip compress="true" casesensitive="yes"
destfile="${src.dist.version.dir}.zip">
<zipfileset dir="${src.dist.version.dir}" filemode="664" prefix="${final.name}">
<exclude name="src/bin/*" />
<include name="**" />
</zipfileset>
<zipfileset dir="${src.dist.version.dir}" filemode="755" prefix="${final.name}">
<include name="src/bin/*" />
</zipfileset>
</zip>
</target>
<!-- ================================================================== -->
<!-- Make bin release zip -->
<!-- ================================================================== -->
<target name="zip-bin" depends="package-bin" description="--> generate bin.zip distribution package">
<zip compress="true" casesensitive="yes"
destfile="${bin.dist.version.dir}.zip">
<zipfileset dir="${bin.dist.version.dir}" filemode="664" prefix="${final.name}">
<exclude name="bin/*" />
<include name="**" />
</zipfileset>
<zipfileset dir="${bin.dist.version.dir}" filemode="755" prefix="${final.name}">
<include name="bin/*" />
</zipfileset>
</zip>
</target>
<!-- ================================================================== -->
<!-- Clean. Delete the build files, and their directories -->
<!-- ================================================================== -->
<!-- target: clean =================================================== -->
<target name="clean" depends="clean-build, clean-lib, clean-dist, clean-runtime" description="--> clean the project" />
<!-- target: clean-local ============================================= -->
<target name="clean-local" depends=""
description="--> cleans the local repository for the current module">
<delete dir="${ivy.local.default.root}/${ivy.organisation}/${ivy.module}"/>
</target>
<!-- target: clean-lib =============================================== -->
<target name="clean-lib" description="--> clean the project libraries directory (dependencies)">
<delete includeemptydirs="true" dir="${build.lib.dir}"/>
<delete includeemptydirs="true" dir="${test.build.lib.dir}"/>
</target>
<!-- target: clean-build ============================================= -->
<target name="clean-build" description="--> clean the project built files">
<delete includeemptydirs="true" dir="${build.dir}"/>
</target>
<!-- target: clean-dist ============================================= -->
<target name="clean-dist" description="--> clean the project dist files">
<delete includeemptydirs="true" dir="${dist.dir}"/>
</target>
<!-- target: clean-cache ============================================= -->
<target name="clean-cache" depends=""
description="--> delete ivy cache">
<ivy:cleancache />
</target>
<target name="clean-runtime" description="--> clean the project runtime area">
<delete includeemptydirs="true" dir="${runtime.dir}"/>
</target>
<!-- ================================================================== -->
<!-- RAT targets -->
<!-- ================================================================== -->
<target name="rat-sources-typedef" description="--> run RAT antlib task">
<typedef resource="org/apache/rat/anttasks/antlib.xml" >
<classpath>
<fileset dir="." includes="rat*.jar"/>
</classpath>
</typedef>
</target>
<target name="rat-sources" depends="rat-sources-typedef"
description="--> runs RAT tasks over src/java">
<rat:report xmlns:rat="antlib:org.apache.rat.anttasks">
<fileset dir="src">
<include name="java/**/*"/>
<include name="plugin/**/src/**/*"/>
</fileset>
</rat:report>
</target>
<!-- ================================================================== -->
<!-- SONAR targets -->
<!-- ================================================================== -->
<!-- Define the Sonar task if this hasn't been done in a common script -->
<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
<classpath path="${ant.library.dir}"/>
<classpath path="${mysql.library.dir}"/>
</taskdef>
<!-- Add the target -->
<target name="sonar" description="--> run SONAR analysis">
<!-- list of mandatory source directories (required) -->
<property name="sonar.sources" value="${src.dir}"/>
<!-- list of properties (optional) -->
<property name="sonar.projectName" value="Nutch Trunk 1.4 Sonar Analysis" />
<property name="sonar.binaries" value="${build.dir}/classes" />
<property name="sonar.binaries" value="${build.dir}/plugins" />
<property name="sonar.tests" value="${test.src.dir}" />
<sonar:sonar workDir="${base.dir}" key="org.apache.nutch:trunk"
version="1.4-SNAPSHOT" xmlns:sonar="antlib:org.sonar.ant"/>
</target>
<!-- ================================================================== -->
<!-- Eclipse targets -->
<!-- ================================================================== -->
<!-- classpath for generating eclipse project -->
<path id="eclipse.classpath">
<fileset dir="${build.lib.dir}">
<include name="*.jar" />
<exclude name="ant-eclipse-1.0-jvm1.2.jar" />
</fileset>
<fileset dir="${build.plugins}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${test.build.lib.dir}">
<include name="*.jar" />
</fileset>
</path>
<!-- target: ant-eclipse-download =================================== -->
<target name="ant-eclipse-download" description="Downloads the ant-eclipse binary.">
<get src="http://downloads.sourceforge.net/project/ant-eclipse/ant-eclipse/1.0/ant-eclipse-1.0.bin.tar.bz2"
dest="${build.dir}/ant-eclipse-1.0.bin.tar.bz2" usetimestamp="false" />
<untar src="${build.dir}/ant-eclipse-1.0.bin.tar.bz2"
dest="${build.dir}" compression="bzip2">
<patternset>
<include name="lib/ant-eclipse-1.0-jvm1.2.jar"/>
</patternset>
</untar>
<delete file="${build.dir}/ant-eclipse-1.0.bin.tar.bz2" />
</target>
<!-- target: eclipse ================================================ -->
<target name="eclipse"
depends="clean,init,resolve-test,job,ant-eclipse-download"
description="Create eclipse project files">
<pathconvert property="eclipse.project">
<path path="${basedir}"/>
<regexpmapper from="^.*/([^/]+)$$" to="\1" handledirsep="yes"/>
</pathconvert>
<taskdef name="eclipse"
classname="prantl.ant.eclipse.EclipseTask"
classpath="${build.dir}/lib/ant-eclipse-1.0-jvm1.2.jar" />
<eclipse updatealways="true">
<project name="${eclipse.project}" />
<classpath>
<library path="${conf.dir}" exported="false" />
<library path="${basedir}/src/bin" exported="false" />
<library pathref="eclipse.classpath" exported="false" />
<source path="${basedir}/src/java/" />
<source path="${basedir}/src/test/" />
<source path="${plugins.dir}/parse-rawxml/src/java"/>
<source path="${plugins.dir}/parse-rawxml/src/test"/>
<source path="${plugins.dir}/index-rawxml/src/java"/>
<source path="${plugins.dir}/index-rawxml/src/test"/>
<source path="${plugins.dir}/index-xmlnamespaces/src/java"/>
<source path="${plugins.dir}/index-xmlnamespaces/src/test"/>
<source path="${plugins.dir}/index-bcubefilter/src/java"/>
<source path="${plugins.dir}/index-bcubefilter/src/test"/>
<source path="${plugins.dir}/creativecommons/src/java/" />
<source path="${plugins.dir}/creativecommons/src/test/" />
<source path="${plugins.dir}/feed/src/java/" />
<source path="${plugins.dir}/feed/src/test/" />
<source path="${plugins.dir}/headings/src/java/" />
<source path="${plugins.dir}/index-anchor/src/java/" />
<source path="${plugins.dir}/index-anchor/src/test/" />
<source path="${plugins.dir}/index-basic/src/java/" />
<source path="${plugins.dir}/index-basic/src/test/" />
<source path="${plugins.dir}/indexer-dummy/src/java/" />
<source path="${plugins.dir}/indexer-solr/src/java/" />
<source path="${plugins.dir}/indexer-elastic/src/java/" />
<source path="${plugins.dir}/index-metadata/src/java/" />
<source path="${plugins.dir}/index-more/src/java/" />
<source path="${plugins.dir}/index-more/src/test/" />
<source path="${plugins.dir}/index-static/src/java/" />
<source path="${plugins.dir}/index-static/src/test/" />
<source path="${plugins.dir}/language-identifier/src/java/" />
<source path="${plugins.dir}/language-identifier/src/test/" />
<source path="${plugins.dir}/lib-http/src/java/" />
<source path="${plugins.dir}/lib-http/src/test/" />
<source path="${plugins.dir}/lib-regex-filter/src/java/" />
<source path="${plugins.dir}/lib-regex-filter/src/test/" />
<source path="${plugins.dir}/microformats-reltag/src/java/" />
<source path="${plugins.dir}/parse-ext/src/java/" />
<source path="${plugins.dir}/parse-ext/src/test/" />
<source path="${plugins.dir}/parse-html/src/java/" />
<source path="${plugins.dir}/parse-html/src/test/" />
<source path="${plugins.dir}/parse-js/src/java/" />
<source path="${plugins.dir}/parse-metatags/src/java/" />
<source path="${plugins.dir}/parse-metatags/src/test/" />
<source path="${plugins.dir}/parse-swf/src/java/" />
<source path="${plugins.dir}/parse-swf/src/test/" />