forked from motasimvd/dotcms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
1141 lines (956 loc) · 51.1 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"?>
<project name="dotcms.org" default="compile" basedir=".">
<!-- property name="build.compiler" value="jikes" / -->
<!-- Load version props -->
<property file="src/com/liferay/portal/util/build.properties"/>
<property file="test/build.properties" />
<property file="../build.conf" />
<!-- vars -->
<property name="src.dir" value="src" />
<property name="src.conf.dir" value="src-conf" />
<property name="src.tests.dir" value="test" />
<property name="src.jsp" value="build/jsp" />
<property name="build.dir" value="build" />
<property name="build.classes" value="${build.dir}/classes" />
<property name="build.ant" value="${build.dir}/ant" />
<property name="build.log4j" value="${build.dir}/log4j" />
<property name="build.lib" value="${build.dir}/lib" />
<property name="lib.app" value="${basedir}/dotCMS/WEB-INF/lib" />
<property name="classes.app" value="${basedir}/dotCMS/WEB-INF/classes" />
<property name="osgi.velocity.dir" value="${basedir}/dotCMS/WEB-INF/velocity/osgi" />
<property name="osgi.html.dir" value="${basedir}/dotCMS/html/osgi" />
<property name="build.war" value="${build.dir}/war" />
<property name="build.compiler.fulldepend" value="true" />
<property name="deploy.dir" value="${basedir}/dotCMS/WEB-INF/lib" />
<property name="ant.build.javac.target" value="1.8"/>
<property name="war.name" value="ROOT"/>
<property name="endorsed_libs" value="${basedir}/dotCMS/WEB-INF/endorsed_libs" />
<property name="agent.version" value="31"/>
<property name="plugin.root.dir.default" value="${basedir}/dotCMS"/>
<property name="plugin.jar.deploy.dir.default" value="${basedir}/../../dotCMS/WEB-INF/lib" />
<property name="dist.update" value="false"/>
<property name="distribution.output" value="../dist" />
<property name="distribution.file.output" value="${distribution.output}/.." />
<property name="distribution.bin.output" value="${distribution.output}/bin" />
<property name="distribution.dotserver.output" value="${distribution.output}/dotserver" />
<property name="distribution.plugins.output" value="${distribution.output}/plugins" />
<property name="distribution.docs.output" value="${distribution.output}/docs" />
<property name="license.project.home" value="../license"/>
<property name="enterprise.project.home" value="../enterprise-2.x"/>
<property name="tomcat.branch" value="${tomcat.install.branch}"/>
<property name="tomcat.home" value="${tomcat.install.location}"/>
<property name="tomcat.version" value="${tomcat.install.version}"/>
<property name="jboss7.home" value="${jboss7.install.location}"/>
<property name="jboss7.version" value="${jboss7.install.version}"/>
<property name="release.build" value="${dotcms.release.build}"/>
<tstamp>
<format property="CURRENT_YEAR" pattern="yyyy" locale="en,GB"/>
</tstamp>
<property name="javadoc.title" value="<h1>dotCMS ${dotcms.release.version} API Specification</h1>" />
<property name="javadoc.bottom" value="<i>Copyright © ${CURRENT_YEAR} dotCMS Inc. All Rights Reserved.</i>" />
<tstamp>
<format property="TODAY_FORMATTED" pattern="MMM dd, yyyy"/>
</tstamp>
<path id="build-classpath">
<pathelement path="${build.classes}" />
</path>
<path id="tests-classpath">
<pathelement location="${java.home}/../lib/tools.jar"/>
<fileset dir="libs/test">
<include name="*.jar" />
</fileset>
<fileset dir="libs/buildlibs">
<include name="*.jar" />
</fileset>
<!--We should be able to remove it soon-->
<fileset dir="libs/buildlibs/jsp">
<include name="jasper.jar" />
<include name="jasper-el.jar" />
<include name="el-api.jar" />
<include name="tomcat-util.jar" />
<include name="tomcat-juli.jar" />
<include name="tomcat-api.jar" />
</fileset>
<!--We should be able to remove it soon-->
<fileset dir="${lib.app}">
<include name="**/*.jar" />
<exclude name="**/dotcms_*.jar" />
</fileset>
<pathelement path="${build.classes}" />
</path>
<path id="files-classpath">
<pathelement location="${java.home}/../lib/tools.jar"/>
<fileset dir="libs/buildlibs">
<include name="*.jar" />
</fileset>
<!--We should be able to remove it soon-->
<fileset dir="libs/buildlibs/jsp">
<include name="jasper.jar" />
<include name="jasper-el.jar" />
<include name="el-api.jar" />
<include name="tomcat-util.jar" />
<include name="tomcat-juli.jar" />
<include name="tomcat-api.jar" />
</fileset>
<!--We should be able to remove it soon-->
<fileset dir="${lib.app}">
<include name="**/*.jar" />
<exclude name="**/dotcms_*.jar" />
</fileset>
<pathelement path="${build.classes}" />
</path>
<!-- classpath only used for plugins no other task should use it because it locks the jar files -->
<path id="ant-files-classpath-custom">
<pathelement location="${java.home}/../lib/tools.jar"/>
<fileset dir="../../${target.root}/WEB-INF/lib">
<include name="ant-tooling-*.jar" />
<include name="commons-lang-*.jar" />
<include name="log4j-api*.jar" />
<include name="log4j-core*.jar" />
<include name="log4j-web*.jar" />
</fileset>
</path>
<path id="ant-files-classpath">
<pathelement location="${java.home}/../lib/tools.jar"/>
<fileset dir="${lib.app}">
<include name="ant-tooling-*.jar" />
<include name="commons-lang-*.jar" />
<include name="log4j-api*.jar" />
<include name="log4j-core*.jar" />
<include name="log4j-web*.jar" />
</fileset>
</path>
<!-- include ant-contrib -->
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<!-- Target to create the build directories prior to the -->
<!-- compile target. -->
<target name="prepare">
<mkdir dir="${distribution.output}" />
<mkdir dir="${build.dir}" />
<mkdir dir="${build.classes}" />
<mkdir dir="${build.lib}" />
</target>
<available file=".git" type="dir" property="git.present"/>
<target name="git.revision" description="Store git revision in ${repository.version}" if="git.present">
<exec executable="git" outputproperty="git.revision" failifexecutionfails="false" errorproperty="">
<arg value="rev-parse"/>
<arg value="--short=7"/>
<arg value="HEAD"/>
</exec>
<condition property="repository.version" value="${git.revision}" else="unknown">
<and>
<isset property="git.revision"/>
<length string="${git.revision}" trim="yes" length="0" when="greater"/>
</and>
</condition>
<propertyfile file="${src.dir}/com/liferay/portal/util/build.properties">
<entry key="dotcms.release.build" value="${repository.version}"/>
<entry key="dotcms.release.date" value="${TODAY_FORMATTED}"/>
</propertyfile>
<!--
If the Hash for the repo version (${repository.version}) has changed,
it needs to be read from a variable instead of read directly from the
build.properties file because Core Ant properties are immutable
-->
<var name="release.build" unset="true"/>
<property name="release.build" value="${repository.version}"/>
</target>
<target name="clean-tinymce-gz" description="Removes all generated .gz pre-compressed files by tinymce_gzip.jsp">
<delete>
<fileset dir="dotCMS/html/js/tinymce/js/tinymce/" includes="*.gz"/>
</delete>
</target>
<target name="clean-core" description="Removes all compiled classes, jar." depends="check-src-build">
<replaceregexp flags="s" match="<!-- BEGIN JSPS -->(.*)<!-- END JSPS -->"
replace="<!-- BEGIN JSPS --> <!-- END JSPS -->">
<fileset dir="dotCMS/WEB-INF/">
<include name="web.xml"/>
</fileset>
</replaceregexp>
<delete>
<fileset dir="${deploy.dir}" includes="dotcms_*.jar" excludes="dotcms_ant.jar" />
</delete>
<delete dir="${build.dir}" />
<delete dir="${src.jsp}" />
<delete dir="${distribution.output}" />
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${classes.app}" includes="**/*" />
</delete>
<delete dir="${osgi.html.dir}" />
<delete dir="${osgi.velocity.dir}" />
</target>
<target name="clean-jsp" description="Removes all compiled jsp files from the tomcat instance.">
<delete dir="${tomcat.home}/work/Catalina" />
</target>
<target name="compile" depends="check-src-build,prepare" description="Compiles all source code.">
<javac debug="true" encoding="UTF-8" debuglevel="lines,vars,source" fork="true" srcdir="${src.dir}" destdir="${build.classes}" source="1.8" target="1.8" compiler="javac1.8" nowarn="true" optimize="true" memoryinitialsize="256m" memorymaximumsize="1024m">
<classpath refid="files-classpath" />
</javac>
<copy file="${src.dir}/com/dotmarketing/beans/DotCMSSeq.hbm.xml" tofile="${build.classes}/com/dotmarketing/beans/DotCMSSeq.hbm.xml" />
<copy file="${src.dir}/com/dotmarketing/beans/DotCMSId.hbm.xml" tofile="${build.classes}/com/dotmarketing/beans/DotCMSId.hbm.xml" />
<copy file="${src.dir}/com/dotmarketing/beans/DotCMSSeq_NOSQLGEN.hbm.xml" tofile="${build.classes}/com/dotmarketing/beans/DotCMSSeq_NOSQLGEN.hbm.xml" />
<copy file="${src.dir}/com/dotmarketing/beans/DotCMSId_NOSQLGEN.hbm.xml" tofile="${build.classes}/com/dotmarketing/beans/DotCMSId_NOSQLGEN.hbm.xml" />
<copydir dest="${build.classes}/com/dotmarketing/startup/runonce/sql" src="${src.dir}/com/dotmarketing/startup/runonce/sql"></copydir>
<copy todir="${build.classes}/org/apache/velocity/runtime/defaults/">
<fileset dir="${src.dir}/org/apache/velocity/runtime/defaults/"/>
</copy>
</target>
<target name="checkWindows" description="Sets the isWindows property if the OS family is windows">
<condition property="isWindows">
<os family="windows" />
</condition>
</target>
<target name="jar" depends="git.revision, compile" description="Generates dotcms.jar in the 'lib' directory.">
<copy file="${src.dir}/com/dotmarketing/beans/DotCMSSeq.hbm.xml" tofile="${build.classes}/com/dotmarketing/beans/DotCMSSeq.hbm.xml" />
<copy file="${src.dir}/com/dotmarketing/beans/DotCMSId.hbm.xml" tofile="${build.classes}/com/dotmarketing/beans/DotCMSId.hbm.xml" />
<copy file="${src.dir}/com/dotmarketing/beans/DotCMSSeq_NOSQLGEN.hbm.xml" tofile="${build.classes}/com/dotmarketing/beans/DotCMSSeq_NOSQLGEN.hbm.xml" />
<copy file="${src.dir}/com/dotmarketing/beans/DotCMSId_NOSQLGEN.hbm.xml" tofile="${build.classes}/com/dotmarketing/beans/DotCMSId_NOSQLGEN.hbm.xml" />
<copydir dest="${build.classes}/com/dotmarketing/startup/runonce/sql" src="${src.dir}/com/dotmarketing/startup/runonce/sql"></copydir>
<copy file="${src.dir}/com/liferay/portal/util/build.properties" tofile="${build.classes}/com/liferay/portal/util/build.properties" />
<jar jarfile="${build.lib}/dotcms_${dotcms.release.version}_${release.build}.jar" basedir="${build.classes}" />
</target>
<target name="jar-with-tests" depends="compile, compile-tests" description="Generates dotcms.jar in the 'lib' directory includind tests classes.">
<copy file="${src.dir}/com/dotmarketing/beans/DotCMSSeq.hbm.xml" tofile="${build.classes}/com/dotmarketing/beans/DotCMSSeq.hbm.xml" />
<copy file="${src.dir}/com/dotmarketing/beans/DotCMSId.hbm.xml" tofile="${build.classes}/com/dotmarketing/beans/DotCMSId.hbm.xml" />
<copy file="${src.dir}/com/dotmarketing/beans/DotCMSSeq_NOSQLGEN.hbm.xml" tofile="${build.classes}/com/dotmarketing/beans/DotCMSSeq_NOSQLGEN.hbm.xml" />
<copy file="${src.dir}/com/dotmarketing/beans/DotCMSId_NOSQLGEN.hbm.xml" tofile="${build.classes}/com/dotmarketing/beans/DotCMSId_NOSQLGEN.hbm.xml" />
<copydir dest="${build.classes}/com/dotmarketing/startup/runonce/sql" src="${src.dir}/com/dotmarketing/startup/runonce/sql"></copydir>
<copy file="${src.dir}/com/liferay/portal/util/build.properties" tofile="${build.classes}/com/liferay/portal/util/build.properties" />
<jar jarfile="${build.lib}/dotcms_${dotcms.release.version}_${release.build}.jar" basedir="${build.classes}" />
</target>
<!-- Configure the directory into which the web application is built -->
<property name="build" value="build" />
<!-- Configure the folder and context path for this application -->
<property name="webapp" value="dotCMS" />
<property name="path" value="/dotCMS" />
<property name="webapp.path" value="${build}/webapp${path}" />
<target name="deploy-config" description="Verify if there is specified a custom location for the dotcms installation. When the war structure is use the 'target.root' property will be set in order to specify where the war folder is located, if not present the normal dotcms git structure is assumed.">
<if>
<!--
Verify if there is specified a custom location for the dotcms installation.
When the war structure is use the "target.root" property will be set in order to
specify where the war folder is located, if not present the normal dotcms git structure is assumed.
-->
<contains string="${target.root}" substring="target.root"/>
<then>
<copy todir="${classes.app}">
<fileset dir="${src.conf.dir}">
<exclude name="**/.svn" />
<exclude name="**/.git" />
</fileset>
</copy>
</then>
<else>
<var name="distributionPath" value="${basedir}/../.."/>
<copy todir="${plugin.root.dir}/WEB-INF/classes">
<fileset dir="${distributionPath}/bin/system/${src.conf.dir}">
<exclude name="**/.svn" />
<exclude name="**/.git" />
</fileset>
</copy>
</else>
</if>
</target>
<target name="deploy-core-jsp" depends="jsp,jar,deploy-config" description="will compile, jar and copy to server lib and update the about page of the site">
<delete>
<fileset dir="${deploy.dir}" includes="dotcms_*.jar" excludes="dotcms_ant.jar" />
</delete>
<copy file="${build.lib}/dotcms_${dotcms.release.version}_${release.build}.jar" tofile="${deploy.dir}/dotcms_${dotcms.release.version}_${release.build}.jar" />
<!-- Freetts -->
<delete dir="${build.classes}" />
</target>
<target name="deploy-core-with-tests-jsp" depends="jsp,jar-with-tests,deploy-config" description="will compile, jar and copy to server lib and update the about page of the site">
<delete>
<fileset dir="${deploy.dir}" includes="dotcms_*.jar" excludes="dotcms_ant.jar" />
</delete>
<copy file="${build.lib}/dotcms_${dotcms.release.version}_${release.build}.jar" tofile="${deploy.dir}/dotcms_${dotcms.release.version}_${release.build}.jar" />
<!-- Freetts -->
<delete dir="${build.classes}" />
</target>
<target name="deploy-core" depends="jar,deploy-config" description="Will compile, generate the dotCMS jar and copy the jar to the server libs folder.">
<delete>
<fileset dir="${deploy.dir}" includes="dotcms_*.jar" excludes="dotcms_ant.jar" />
</delete>
<copy file="${build.lib}/dotcms_${dotcms.release.version}_${release.build}.jar" tofile="${deploy.dir}/dotcms_${dotcms.release.version}_${release.build}.jar" />
<!-- Freetts -->
<delete dir="${build.classes}" />
</target>
<target name="deploy-core-with-tests" depends="jar-with-tests,deploy-config" description="will compile, jar and copy to server lib and update the about page of the site">
<delete>
<fileset dir="${deploy.dir}" includes="dotcms_*.jar" excludes="dotcms_ant.jar" />
</delete>
<copy file="${build.lib}/dotcms_${dotcms.release.version}_${release.build}.jar" tofile="${deploy.dir}/dotcms_${dotcms.release.version}_${release.build}.jar" />
<!-- Freetts -->
<delete dir="${build.classes}" />
</target>
<target name="build-core-jsp" depends="jsp,jar" description="will compile, build sql scripts and update the about page of the site" />
<target name="build-core" depends="jar" description="will compile, build sql scripts and update the about page of the site" />
<target name="deploy" depends="jar,deploy-config" description="will compile, jar and copy to server lib and update the about page of the site">
<delete>
<fileset dir="${deploy.dir}" includes="dotcms_*.jar" excludes="dotcms_ant.jar" />
</delete>
<copy file="${build.lib}/dotcms_${dotcms.release.version}_${release.build}.jar" tofile="${deploy.dir}/dotcms_${dotcms.release.version}_${release.build}.jar" />
<antcall target="deploy-plugins" />
</target>
<target name="jsp" depends="compile">
<taskdef classname="com.dotmarketing.util.jasper.DotJasperTask" name="jasper2" >
<classpath id="jspc.classpath" refid="files-classpath">
</classpath>
</taskdef>
<jasper2
validateXml="false"
uriroot="dotCMS"
javaEncoding="UTF-8"
webXmlFragment="dotCMS/WEB-INF/generated_web.xml"
outputDir="${src.jsp}/">
</jasper2>
<javac debug="true" debuglevel="lines,vars,source" encoding="UTF-8"
fork="true" srcdir="${src.jsp}" destdir="${build.classes}" source="1.8"
target="1.8" compiler="javac1.8" nowarn="true" optimize="true"
memoryinitialsize="256m" memorymaximumsize="1024m">
<classpath refid="files-classpath" />
</javac>
<loadfile property="generated.web"
srcFile="dotCMS/WEB-INF/generated_web.xml"/>
<replaceregexp flags="s" match="<!-- BEGIN JSPS -->(.*)<!-- END JSPS -->"
replace="<!-- BEGIN JSPS --> ${generated.web} <!-- END JSPS -->">
<fileset dir="dotCMS/WEB-INF/">
<include name="web.xml"/>
</fileset>
</replaceregexp>
</target>
<target name="create-dist" description="Creates the final distribution files for dotCMS.">
<var name="tomcat.home" value="${distribution.dotserver.output}/tomcat-${tomcat.version}"/>
<antcall target="clean" />
<!--Clone tomcat-->
<git-clone-pull repository="https://github.com/dotCMS/tomcat.git" version="${tomcat.branch}" dest="${tomcat.home}"/>
<!--Generate the war-->
<antcall target="war" />
<!--Move the war to the ./dotserver/tomcat-7.x.x/webapps folder-->
<antcall target="move-war-tomcat" />
<!--bin folder (./bin)-->
<copy todir="${distribution.bin.output}">
<fileset dir="bin">
<exclude name="com/**"/>
<exclude name="net/**"/>
<exclude name="org/**"/>
<exclude name="**/*.class"/>
</fileset>
</copy>
<!--bin folder (./bin/system/src-conf)-->
<copy todir="${distribution.bin.output}/system/src-conf">
<fileset dir="src-conf">
<include name="**/*"/>
</fileset>
</copy>
<!--plugins folder (./plugins) -->
<copy todir="${distribution.plugins.output}">
<fileset dir="plugins">
<exclude name="**/.git" />
</fileset>
</copy>
<!--docs folder (./docs) -->
<copy todir="${distribution.docs.output}">
<fileset dir="docs">
<include name="**/*"/>
</fileset>
</copy>
<!--Set some startup variables-->
<replace file="${distribution.bin.output}/build.conf"><!--Unix-->
<replacefilter token="#SERVER_FOLDER" value="SERVER_FOLDER"/>
<replacefilter token="{server.folder}" value="dotserver/tomcat-${tomcat.version}"/>
<replacefilter token="#HOME_FOLDER" value="HOME_FOLDER"/>
<replacefilter token="{home.folder}" value="$SERVER_FOLDER/webapps/ROOT"/>
<replacefilter token="#target.root" value="target.root"/>
<replacefilter token="{dotcms.home}" value="dotserver/tomcat-${tomcat.version}/webapps/ROOT"/>
</replace>
<replace file="${distribution.bin.output}/build.conf.bat"><!--For windows-->
<replacefilter token="rem set" value="set"/>
<replacefilter token="{server.folder}" value="dotserver\tomcat-${tomcat.version}"/>
<replacefilter token="{home.folder}" value="dotserver\tomcat-${tomcat.version}\webapps\ROOT"/>
<replacefilter token="{dotcms.home}" value="dotserver\tomcat-${tomcat.version}\webapps\ROOT"/>
</replace>
<copy file="build.xml" todir="${distribution.bin.output}/ant"/>
<!--<antcall target="javadoc" />-->
<if>
<equals arg1="${dist.update}" arg2="true"/>
<then>
<delete file="${distribution.dotserver.output}/tomcat-${tomcat.version}/webapps/ROOT/starter.zip"/>
</then>
</if>
<zip destfile="${distribution.file.output}/dotcms_${dotcms.release.version}.zip" basedir="${distribution.output}"/>
<if>
<equals arg1="${dist.update}" arg2="false"/>
<then>
<tar destfile="${distribution.file.output}/dotcms_${dotcms.release.version}.tar.gz" compression="gzip" longfile="gnu">
<tarfileset dir="${distribution.output}">
<include name="**/**"/>
</tarfileset>
<tarfileset dir="${distribution.output}/bin" prefix="/bin" filemode="755">
<include name="**/*.sh"/>
</tarfileset>
<tarfileset dir="${distribution.output}/dotserver/tomcat-${tomcat.version}/bin" prefix="/dotserver/tomcat-${tomcat.version}/bin" filemode="755">
<include name="**/*.sh"/>
</tarfileset>
<tarfileset dir="${distribution.output}/dotserver/tomcat-${tomcat.version}/webapps/ROOT" prefix="/dotserver/tomcat-${tomcat.version}/webapps/ROOT" filemode="755">
<include name="**/*.sh"/>
</tarfileset>
</tar>
</then>
</if>
<delete dir="${distribution.output}" />
</target>
<target name="create-update-dist" description="Creates an update distribution zip file.">
<var name="dist.update" unset="true"/>
<property name="dist.update" value="true"/>
<antcall target="create-dist"/>
</target>
<target name="javadoc" description="creates javadoc for dotCMS">
<javadoc maxmemory="1024m" packagenames="com.dotmarketing.*,com.dotcms.*" classpath="lib.app" sourcepath="${src.dir}" excludepackagenames="com.dummy.test.doc-files.*" defaultexcludes="yes" destdir="dotCMS/api" author="true" version="true" use="true" windowtitle="dotCMS API">
<classpath refid="files-classpath" />
<doctitle>
${javadoc.title}
</doctitle>
<bottom>
${javadoc.bottom}
</bottom>
<tag name="todo" scope="all" description="To do:" />
</javadoc>
</target>
<target name="compile-tests" depends="prepare,compile,deploy-config" description="Compiles all test source code.">
<copy todir="${lib.app}">
<fileset dir="libs/test/">
<include name="*.jar"/>
</fileset>
</copy>
<javac encoding="UTF-8" debug="true" debuglevel="lines,vars,source" fork="true" srcdir="${src.tests.dir}" destdir="${build.classes}" source="1.8" target="1.8" compiler="javac1.8" nowarn="true" optimize="true" memoryinitialsize="256m" memorymaximumsize="1024m">
<classpath refid="files-classpath" />
</javac>
<copy todir="${build.classes}">
<fileset dir="${src.tests.dir}">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="create-jar-tests" depends="prepare,compile" description="Compiles all test source code and outputs a jar with the tests only">
<mkdir dir="${build.dir}/testbuild" />
<javac encoding="UTF-8" debug="true" debuglevel="lines,vars,source" fork="true" srcdir="${src.tests.dir}" destdir="${build.dir}/testbuild" source="1.8" target="1.8" compiler="javac1.8" nowarn="true" optimize="true" memoryinitialsize="256m" memorymaximumsize="1024m">
<classpath refid="tests-classpath" />
</javac>
<copy todir="${build.dir}/testbuild">
<fileset dir="${src.tests.dir}">
<exclude name="**/*.java"/>
</fileset>
</copy>
<jar jarfile="${distribution.file.output}/dotcms_tests_${dotcms.release.version}.jar" basedir="${build.dir}/testbuild" />
<copy todir="${distribution.file.output}">
<fileset dir="libs/test/">
<include name="*.jar"/>
</fileset>
</copy>
</target>
<target name="uncomment-test-servlet" description="By default we need ServletTestRunner to be commented in web.xml so deployments doesn't have /dotTest as a public endpoint.">
<!--Comment-->
<replaceregexp flags="s" match="<!-- TEST FRAMEWORK SERVLETS -->"
replace="<!-- TEST FRAMEWORK SERVLETS ">
<fileset dir="dotCMS/WEB-INF/">
<include name="web.xml"/>
</fileset>
</replaceregexp>
<replaceregexp flags="s" match="<!-- END OF TEST FRAMEWORK SERVLETS -->"
replace="END OF TEST FRAMEWORK SERVLETS -->">
<fileset dir="dotCMS/WEB-INF/">
<include name="web.xml"/>
</fileset>
</replaceregexp>
<!--Uncomment-->
<replaceregexp flags="s" match="<!-- TEST FRAMEWORK SERVLETS"
replace="<!-- TEST FRAMEWORK SERVLETS -->">
<fileset dir="dotCMS/WEB-INF/">
<include name="web.xml"/>
</fileset>
</replaceregexp>
<replaceregexp flags="s" match="END OF TEST FRAMEWORK SERVLETS -->"
replace="<!-- END OF TEST FRAMEWORK SERVLETS -->">
<fileset dir="dotCMS/WEB-INF/">
<include name="web.xml"/>
</fileset>
</replaceregexp>
</target>
<!--Plugin tasks-->
<target name="build-jsp" depends="build-core-jsp,build-plugins" description="build the dotCMS core and plugins" />
<target name="build" depends="build-core,build-plugins" description="build the dotCMS core and plugins" />
<target name="deploy-jsp" depends="build-jsp, deploy-core-jsp, deploy-plugins" description="@Deprecated: Compiles the jsp files and deploys core and plugins." />
<target name="deploy-tests" depends="uncomment-test-servlet, build, deploy-core-with-tests, deploy-plugins" description="builds and deploys core, plugins and unit tests" />
<target name="clean" depends="clean-plugins,undeploy-plugins,clean-core,clean-tinymce-gz" description="Cleans plugins and core code and also undeploys plugins" />
<macrodef name="iterate">
<attribute name="target"/>
<sequential>
<subant target="@{target}">
<fileset dir="plugins" includes="*/build.xml"/>
</subant>
</sequential>
</macrodef>
<macrodef name="iterate-dist">
<attribute name="target"/>
<sequential>
<subant target="@{target}">
<fileset dir="../../plugins" includes="*/build.xml"/>
</subant>
</sequential>
</macrodef>
<target name="build-plugins" depends="setup-deploy-location" description="builds plugins but does not deploy">
<var name="lib.app" unset="true"/>
<property name="lib.app" value="${plugin.root.dir}/WEB-INF/lib"/>
<if>
<!--
Verify if there is specified a custom location for the dotcms installation.
When the war structure is used the "target.root" property will be set in order to
specify where the war folder is located, if not present the normal dotcms git structure is assumed.
-->
<contains string="${target.root}" substring="target.root"/>
<then>
<iterate target="build"/>
</then>
<else>
<iterate-dist target="build"/>
</else>
</if>
</target>
<target name="clean-plugins" description="undeploys and cleans plugins" depends="undeploy-plugins">
<if>
<!--
Verify if there is specified a custom location for the dotcms installation.
When the war structure is used the "target.root" property will be set in order to
specify where the war folder is located, if not present the normal dotcms git structure is assumed.
-->
<contains string="${target.root}" substring="target.root"/>
<then>
<iterate target="clean"/>
</then>
<else>
<iterate-dist target="clean"/>
</else>
</if>
</target>
<target name="unbuild-plugins" description="Cleans plugins">
<if>
<!--
Verify if there is specified a custom location for the dotcms installation.
When the war structure is used the "target.root" property will be set in order to
specify where the war folder is located, if not present the normal dotcms git structure is assumed.
-->
<contains string="${target.root}" substring="target.root"/>
<then>
<iterate target="clean"/>
</then>
<else>
<iterate-dist target="clean"/>
</else>
</if>
</target>
<target name="-check-use-file">
<available property="file.exists" file="build.properties"/>
</target>
<target name="use-file" depends="-check-use-file" if="file.exists">
<loadproperties srcFile="build.properties"/>
</target>
<target name="setup-deploy-location" depends="use-file" description="sets up the locations where to deploy">
<condition property="plugin.root.dir" value="${basedir}/../../${target.root}" else="${plugin.root.dir.default}">
<isset property="target.root"/>
</condition>
<condition property="plugin.jar.deploy.dir" value="${target.root}/WEB-INF/lib" else="${plugin.root.dir.default}/WEB-INF/lib">
<isset property="target.root"/>
</condition>
<echo>Deploying plugins to: ${plugin.root.dir} | ${plugin.jar.deploy.dir}</echo>
</target>
<target name="deploy-plugins" depends="build-plugins, undeploy-plugins" description="builds and deploys plugins">
<echo>Copying plugins to: ${plugin.root.dir}</echo>
<if>
<!--
Verify if there is specified a custom location for the dotcms installation.
When the war structure is used the "target.root" property will be set in order to
specify where the war folder is located, if not present the normal dotcms git structure is assumed.
-->
<contains string="${target.root}" substring="target.root"/>
<then>
<var name="distributionPath" value="${basedir}"/>
<var name="pluginsPath" value="plugins"/>
</then>
<else>
<var name="distributionPath" value="${basedir}/../.."/>
<var name="pluginsPath" value="../../plugins"/>
</else>
</if>
<copy todir="${plugin.root.dir}/WEB-INF/classes" file="${pluginsPath}/plugins.xml" />
<subant target="deploy-plugin" genericantfile="${basedir}/build.xml">
<dirset dir="${pluginsPath}" includes="*"/>
<property name="plugin.root.dir" value="${plugin.root.dir}"/>
<property name="target.root" value="${target.root}"/>
<property name="plugin.jar.deploy.dir" value="${plugin.jar.deploy.dir}"/>
</subant>
<if>
<contains string="${target.root}" substring="target.root"/>
<then>
<taskdef classname="com.dotmarketing.plugin.ant.DeployTask" name="plugin-deploy-task">
<classpath id="plugin-deploy-task.classpath" refid="ant-files-classpath"/>
</taskdef>
</then>
<else>
<taskdef classname="com.dotmarketing.plugin.ant.DeployTask" name="plugin-deploy-task">
<classpath id="plugin-deploy-task.classpath" refid="ant-files-classpath-custom"/>
</taskdef>
</else>
</if>
<echo>Deploying plugins from: ${plugin.root.dir}</echo>
<plugin-deploy-task distributionPath="${distributionPath}" dotcmsHome="${plugin.root.dir}" plugins="${plugin.root.dir}/WEB-INF/lib"/>
</target>
<target name="deploy-plugin">
<if>
<!--
Verify if there is specified a custom location for the dotcms installation.
When the war structure is used the "target.root" property will be set in order to
specify where the war folder is located, if not present the normal dotcms git structure is assumed.
-->
<contains string="${target.root}" substring="target.root"/>
<then>
<copy todir="${plugin.jar.deploy.dir}">
<fileset dir="build/jar/" />
</copy>
</then>
<else>
<copy todir="../../${plugin.jar.deploy.dir}">
<fileset dir="build/jar/" />
</copy>
</else>
</if>
</target>
<target name="undeploy-plugins" depends="setup-deploy-location" description="Undeploys all plugins, returns overridden files to default state. This task does not need to be executed as a pre-condition of deploy-plugins because that task executes it automatically.">
<var name="lib.app" unset="true"/>
<property name="lib.app" value="${plugin.root.dir}/WEB-INF/lib"/>
<if>
<!--
Verify if there is specified a custom location for the dotcms installation.
When the war structure is used the "target.root" property will be set in order to
specify where the war folder is located, if not present the normal dotcms git structure is assumed.
-->
<contains string="${target.root}" substring="target.root"/>
<then>
<var name="distributionPath" value="${basedir}"/>
<taskdef classname="com.dotmarketing.plugin.ant.UndeployTask" name="plugin-undeploy-task">
<classpath id="plugin-deploy-task.classpath" refid="ant-files-classpath">
</classpath>
</taskdef>
</then>
<else>
<var name="distributionPath" value="${basedir}/../.."/>
<taskdef classname="com.dotmarketing.plugin.ant.UndeployTask" name="plugin-undeploy-task">
<classpath id="plugin-deploy-task.classpath" refid="ant-files-classpath-custom">
</classpath>
</taskdef>
</else>
</if>
<echo>Undeploying plugins from: ${plugin.root.dir}</echo>
<plugin-undeploy-task distributionPath="${distributionPath}" dotcmsHome="${plugin.root.dir}" plugins="${plugin.root.dir}/WEB-INF/lib"/>
<delete>
<fileset dir="${plugin.root.dir}/WEB-INF/lib" includes="**/plugin-*.jar"/>
<fileset dir="${plugin.root.dir}/WEB-INF/lib" includes="**/pluginlib-*.jar"/>
</delete>
<delete file="${plugin.root.dir}/WEB-INF/classes/plugins.xml" />
<delete dir="${plugin.root.dir}/html/plugins" failonerror="false" />
<antcall target="deploy-config" />
</target>
<target name="clean-plugins-libs" depends="setup-deploy-location" description="Deletes the plugins jars from the lib folder.">
<delete>
<fileset dir="${plugin.root.dir}/WEB-INF/lib" includes="**/plugin-*.jar"/>
<fileset dir="${plugin.root.dir}/WEB-INF/lib" includes="**/pluginlib-*.jar"/>
</delete>
</target>
<target name="check-src-build" description="Checks to see if a build-core is possible. Fails if the src directory is missing. This prevents sourceless installs from running a clean" >
<available file="${src.dir}/com/dotmarketing" type="dir" property="src.dir.present" />
<fail message="Source directory not present. If trying to deploy plugins, please use bin/deploy-plugins.sh or bin/deploy-plugins.bat instead" unless="src.dir.present" />
</target>
<target name="war" depends="deploy" description="builds dotCMS as a war without the jsps precompiled">
<antcall target="war-file"/><!--This depends on depends="war-file"-->
</target>
<target name="war-tests" depends="deploy-tests" description="builds dotCMS as a war without the jsps precompiled">
<antcall target="war-file"/>
</target>
<target name="war-file" description="Builds dotCMS as a war">
<!--Clean-up-->
<delete dir="${build.war}"/>
<mkdir dir="${build.war}"/>
<!--Prepare the content of the war-->
<copy todir="${build.war}/${war.name}.war">
<fileset dir="dotCMS/">
<exclude name="assets/"/>
<exclude name="WEB-INF/backup/"/>
<exclude name="WEB-INF/dotlucene/"/>
<exclude name="WEB-INF/classes/"/>
<exclude name="dot_secure/"/>
<exclude name="dotsecure/"/>
</fileset>
</copy>
<copy todir="${build.war}/${war.name}.war/WEB-INF/classes" overwrite="true" includeemptydirs="false">
<fileset dir="dotCMS/WEB-INF/classes">
<exclude name="**/.svn" />
<exclude name="**/.git" />
</fileset>
</copy>
<!--Create the war-->
<war destfile="${build.war}/dotcms_${dotcms.release.version}.war" webxml="dotCMS/WEB-INF/web.xml">
<fileset dir="${build.war}/${war.name}.war">
<exclude name="WEB-INF/web.xml"/>
</fileset>
</war>
</target>
<!--
Task mean to be use from a distribution structure using the buildwar.sh script.
This task will just use the already deployed folder inside the app server and compressed to a war file.
-->
<target name="custom-dist-war" depends="deploy-plugins" description="Builds a dotCMS as a war. (Task mean to be use from a distribution structure using the buildwar.sh script. This task will just use the already deployed folder inside the app server and compressed into a war file.)">
<!--Clean-up-->
<delete dir="../../WAR"/>
<mkdir dir="../../WAR"/>
<!--Create the war-->
<war destfile="../../WAR/${war.name}.war" webxml="${basedir}/../../${target.root}/WEB-INF/web.xml">
<fileset dir="${basedir}/../../${target.root}">
<exclude name="WEB-INF/web.xml"/>
<exclude name="**/*.db"/>
<exclude name="assets/**"/>
<exclude name="dotsecure/**"/>
</fileset>
</war>
</target>
<target name="undeploy-war-tomcat">
<delete dir="${tomcat.home}/webapps/ROOT"/>
</target>
<target name="undeploy-war-jboss7">
<delete file="${jboss7.home}/standalone/deployments/${war.name}.war.dodeploy"/>
<delete dir="${jboss7.home}/standalone/deployments/${war.name}.war"/>
</target>
<target name="deploy-war-tomcat" depends="clone-pull-tomcat, war" description="Will checkout the tomcat app server, generate a war structure and copy it to the just checked out tomcat. If the app server exist instead of a checkout a git pull will be use.">
<antcall target="move-war-tomcat"/>
</target>
<target name="deploy-war-tomcat-dev" description="Same as deploy-war-tomcat but will use the no obfuscated version of the license and enterprise jars. (Useful for development)">
<antcall target="generate-move-clean-projects-tomcat"/>
<antcall target="deploy-war-tomcat"/>
</target>
<target name="generate-move-clean-projects-tomcat">
<antcall target="generate-move-clean-license-tomcat"/>
<antcall target="generate-move-clean-enterprise-tomcat"/>
</target>
<target name="generate-move-clean-license-tomcat">
<!--Generate the projects jars-->
<ant antfile="${license.project.home}/build.xml" target="jar" inheritAll="false"/>
<!--Delete the old jars-->
<delete>
<fileset dir="${tomcat.home}/webapps/ROOT/WEB-INF/lib" includes="eelic-*"/>
<fileset dir="dotCMS/WEB-INF/lib" includes="eelic-*" />
</delete>
<!--Copy the jar-->
<copy todir="${tomcat.home}/webapps/ROOT/WEB-INF/lib">
<fileset dir="${license.project.home}/build">
<include name="eelic_clean.jar"/>
</fileset>
</copy>
<copy todir="dotCMS/WEB-INF/lib">
<fileset dir="${license.project.home}/build">
<include name="eelic_clean.jar"/>
</fileset>
</copy>
</target>
<target name="generate-move-clean-enterprise-tomcat">
<!--Generate the projects jars-->
<ant antfile="${enterprise.project.home}/build.xml" target="jar" inheritAll="false"/>
<!--Delete the old jars-->
<delete>
<fileset dir="${tomcat.home}/webapps/ROOT/WEB-INF/lib" includes="ee-*" />
<fileset dir="dotCMS/WEB-INF/lib" includes="ee-*" />
</delete>
<!--Copy the jar-->
<copy todir="${tomcat.home}/webapps/ROOT/WEB-INF/lib">
<fileset dir="${enterprise.project.home}/build">
<include name="ee_clean.jar"/>
</fileset>
</copy>
<copy todir="dotCMS/WEB-INF/lib">
<fileset dir="${enterprise.project.home}/build">
<include name="ee_clean.jar"/>
</fileset>
</copy>
</target>
<!--
Same as the deploy-war-tomcat except that it will backup the assets and dotsecure folders in order to restore them after the deploy.
This is useful in cases when you need to make a deploy-war-tomcat but keeping your current data.
-->
<target name="deploy-war-tomcat-backup" depends="clone-pull-tomcat, backup-war-tomcat-data, war" description="Same as 'deploy-war-tomcat' but will also backup and restore the assets, dotsecure, META-INF and h2 database folders. (Useful for development)">
<antcall target="move-war-tomcat"/>
<antcall target="restore-backup-war-tomcat-data"/>
</target>
<!--
Same as the deploy-war-tomcat-tests except that it will backup the assets and dotsecure folders in order to restore them after the deploy.
This is useful in cases when you need to make a deploy-war-tomcat-tests but keeping your current data.
-->
<target name="deploy-war-tomcat-tests-backup" depends="clone-pull-tomcat, backup-war-tomcat-data, war-tests" description="Same as 'deploy-war-tomcat-backup' but also includes the junit tests.">
<antcall target="move-war-tomcat"/>
<antcall target="restore-backup-war-tomcat-data"/>
</target>
<target name="deploy-war-tomcat-tests" depends="clone-pull-tomcat, war-tests" description="Same as 'deploy-war-tomcat' but also includes the junit tests.">
<antcall target="move-war-tomcat"/>
</target>
<target name="deploy-war-jboss7" depends="clone-pull-jboss7, war" description="Will checkout the jboss app server, generate a war structure and copy it to the just checked out jboss. If the app server exist instead of a checkout a git pull will be use.">
<antcall target="move-war-jboss7"/>
</target>
<target name="deploy-jsp-tomcat" description="Moves the jsp files from a git checkout to the tomcat (Useful for development).">
<var name="exploded.war.location" value="${tomcat.home}/webapps/ROOT"/>
<antcall target="deploy-jsp-app-server"/>
</target>
<target name="deploy-jsp-jboss7" description="Moves the jsp files from a git checkout to the jboss (Useful for development).">
<var name="exploded.war.location" value="${jboss7.home}/standalone/deployments/${war.name}.war"/>
<antcall target="deploy-jsp-app-server"/>
</target>
<target name="deploy-jsp-app-server" description="Moves the jsp files from a git checkout to a specified app server location (Useful for development).">
<copy todir="${exploded.war.location}/html/" overwrite="true">
<fileset dir="dotCMS/html/">
<exclude name="**/.git" />
</fileset>
</copy>
<copy todir="${exploded.war.location}/portal/" overwrite="true">
<fileset dir="dotCMS/portal/">
<exclude name="**/.git" />
</fileset>
</copy>
<copy todir="${exploded.war.location}/WEB-INF/jsp/" overwrite="true">
<fileset dir="dotCMS/WEB-INF/jsp/">
<exclude name="**/.git" />
</fileset>
</copy>
</target>
<target name="move-war-tomcat" depends="undeploy-war-tomcat" description="Moves the generated war under the build folder to the tomcat webapps folder.">
<copy todir="${tomcat.home}/lib/">
<fileset dir="libs/buildlibs/">
<include name="mail.jar"/>
<include name="mssql-jdbc-6.2.2.jre8.jar"/>
<include name="mysql-connector-java-5.1.37-bin.jar"/>
<include name="postgresql-42.2.2.jar"/>
<include name="ojdbc5.jar"/>