forked from Keyfactor/ejbca-ce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
1720 lines (1547 loc) · 89.2 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
<project name="ejbca" default="build" basedir=".">
<!-- Import build specific info, like version number -->
<property file="src/internal.properties" />
<dirname property="ejbca.home" file="${ant.file.ejbca}"/>
<property environment="env" />
<!-- set global properties for this build -->
<property name="tmp" value="${ejbca.home}/tmp" />
<property name="lib" value="${ejbca.home}/lib" />
<property name="dist.dir" location="${ejbca.home}/dist" />
<property name="hwtoken_classes" value="hwtoken"/>
<property name="hwtoken.class.dir" location="${hwtoken_classes}" />
<property name="apidoc" value="${ejbca.home}/doc/api" />
<!-- include the standard properties and paths
<import file="propertyDefaults.xml"/>
-->
<!-- this import is used by the modules scheme-->
<import file="${ejbca.home}/modules/build-properties.xml"/>
<import file="bin/${appserver.type}.xml" optional="true"/><!-- We might just want to build the clientToolBox with an appserver. -->
<property name="reports.base.dir" location="${ejbca.home}/reports/"/>
<property name="reports.dir" location="${reports.base.dir}/test"/>
<import file="./test.xmli" />
<import file="./docs.xmli" />
<!-- Include the build file which takes care of removed features detection (for options etc). -->
<import file="./removed.xml" />
<!-- Include the build file which takes care of deprecation detection (for options etc). -->
<import file="./deprecated.xml" />
<!-- =================================================================== -->
<!-- Clean ALL -->
<!-- =================================================================== -->
<target name="clean" depends="deprecated:check">
<delete dir="${dist.dir}" />
<delete dir="${reports.base.dir}" />
<delete dir="${apidoc}" />
<delete dir="${tmp}"/>
<delete file="velocity.log" />
<delete file="validationtool.log" />
<ant antfile="modules/build.xml" target="clean" inheritall="true" inheritrefs="true"/>
</target>
<!-- =================================================================== -->
<!-- Clean Dist dirs -->
<!-- =================================================================== -->
<target name="cleanDistDir" depends="deprecated:check">
<delete dir="${dist.dir}" />
<ant antfile="modules/build.xml" target="clean" inheritall="false"/>
</target>
<!-- =================================================================== -->
<!-- Clean Reports and Screenshots -->
<!-- =================================================================== -->
<target name="cleanReports" description="Clean up this module">
<delete dir="${reports.base.dir}/images"/>
<delete file="${reports.base.dir}/QaEjbcaTestReport.html" />
</target>
<!-- =================================================================== -->
<!-- Build ALL -->
<!-- =================================================================== -->
<target name="build" depends="deprecated:check, fail-unless-appserver-detected, testforgnujava, ejbca.ear" description="Builds EJBCA"/>
<!--
Installs EJBCA by creating an initial CA and generating certs for
SSL and the super administrator.
-->
<target name="runinstall">
<ant dir="${ejbca.home}/bin" antfile="cli.xml" target="ejbca:install" />
</target>
<target name="javatruststore" depends="testforgnujava, deprecated:check" description="Install RootCA certificate in Java trust store (can be run wih -Dca.name=FooCA -Dtrust.keystore=trust.jks -Dtrust.password=foo123). Use alphanumeric password to avoid potential escaping issues.">
<ant dir="${ejbca.home}/bin" antfile="cli.xml" target="ejbca:javatruststore" />
<antcall target="jee:deploytruststore" />
</target>
<!-- =================================================================== -->
<!-- Make sure the user isn't using the GNU version of java -->
<!-- =================================================================== -->
<target name="testforgnujava">
<exec executable="java" outputproperty="testforgnujava.temp">
<arg value="-version" />
</exec>
<fail>
<condition>
<contains string="${testforgnujava.temp}" substring="gij" />
</condition>
..
You are currently using the GNU version of JAVA. Please install the version from Sun
or make sure that the Sun version of java is in the path. If this was run using 'sudo'
or 'su', make sure that the superuser has the correct path too.
</fail>
</target>
<!-- =================================================================== -->
<!-- Dont allow deploy of the wrong thing in production -->
<!-- =================================================================== -->
<target name="failinproduction-deprecation">
<fail message="ejbca.productionmode no longer supports 'va' or 'ocsp' options. Use 'true' instead.">
<condition>
<or>
<equals arg1="${ejbca.productionmode}" arg2="va" casesensitive="false"/>
<equals arg1="${ejbca.productionmode}" arg2="ocsp" casesensitive="false"/>
</or>
</condition>
</fail>
</target>
<target name="failinproduction">
<fail message="ejbca.productionmode must be set to false for this operation.">
<condition>
<or>
<not>
<equals arg1="${ejbca.productionmode}" arg2="false" casesensitive="false"/>
</not>
</or>
</condition>
</fail>
</target>
<!-- =================================================================== -->
<!-- Build ca ejb part -->
<!-- =================================================================== -->
<target name="ejbca-ejb.jar">
<ant antfile="build.xml" dir="modules" target="ejbca-ejb" />
</target>
<!-- =================================================================== -->
<!-- Build ejbca common part -->
<!-- =================================================================== -->
<target name="ejbca-common.jar" depends="deprecated:check" description="Creates ejbca util classes for use in other projects.jar">
<ant antfile="build.xml" dir="modules" target="ejbca-common" />
</target>
<macrodef name="jar-replacement-in-module" description="Optionally enable and configure a EJB module in the EAR">
<attribute name="replacement-tag"/>
<attribute name="replacement-file"/>
<attribute name="replacement-enabled"/>
<attribute name="replacement-ejb"/>
<sequential>
<condition property="replacement-string-@{replacement-ejb}" else="@{replacement-tag}" value="module><ejb>@{replacement-ejb}</ejb></module>">
<istrue value="@{replacement-enabled}"/>
</condition>
<replace file="@{replacement-file}" token="@{replacement-tag}" value="${replacement-string-@{replacement-ejb}}"/>
<condition property="didwhat-@{replacement-ejb}" else="Disabled" value="Enabled">
<istrue value="@{replacement-enabled}"/>
</condition>
<echo message="${didwhat-@{replacement-ejb}} module @{replacement-ejb}"/>
</sequential>
</macrodef>
<macrodef name="connector-replacement-in-module" description="Optionally enable and configure a EJB connector in the EAR">
<attribute name="replacement-tag"/>
<attribute name="replacement-file"/>
<attribute name="replacement-enabled"/>
<attribute name="replacement-connector"/>
<sequential>
<condition property="replacement-string-@{replacement-connector}" else="@{replacement-tag}" value="module><connector>@{replacement-connector}</connector></module>">
<istrue value="@{replacement-enabled}"/>
</condition>
<replace file="@{replacement-file}" token="@{replacement-tag}" value="${replacement-string-@{replacement-connector}}"/>
<condition property="didwhat-@{replacement-connector}" else="Disabled" value="Enabled">
<istrue value="@{replacement-enabled}"/>
</condition>
<echo message="${didwhat-@{replacement-connector}} module @{replacement-connector}"/>
</sequential>
</macrodef>
<macrodef name="war-replacement-in-module" description="Optionally enable and configure a WAR module in the EAR">
<attribute name="replacement-tag"/>
<attribute name="replacement-file"/>
<attribute name="replacement-enabled"/>
<attribute name="replacement-web-uri"/>
<attribute name="replacement-context-root"/>
<sequential>
<condition property="replacement-string-@{replacement-web-uri}" else="@{replacement-tag}" value="module><web><web-uri>@{replacement-web-uri}</web-uri><context-root>@{replacement-context-root}</context-root></web></module>">
<istrue value="@{replacement-enabled}"/>
</condition>
<condition property="replacement-echo-@{replacement-web-uri}" value="true">
<istrue value="@{replacement-enabled}"/>
</condition>
<replace file="@{replacement-file}" token="@{replacement-tag}" value="${replacement-string-@{replacement-web-uri}}"/>
<condition property="didwhat-@{replacement-web-uri}" else="Disabled" value="Enabled">
<istrue value="@{replacement-enabled}"/>
</condition>
<echo message="${didwhat-@{replacement-web-uri}} module @{replacement-web-uri}"/>
</sequential>
</macrodef>
<target name="condition.pluginIsJarBased">
<property file="${ejbca.plugin.property.file}"/>
<condition property="pluginIsJarBased">
<not>
<isset property="plugin.ejbca.ant.file"/>
</not>
</condition>
</target>
<target name="build-one-plugin" depends="condition.pluginIsJarBased, include-plugin-from-jar, build-one-plugin-from-source" />
<target name="include-plugin-from-jar" if="pluginIsJarBased">
<property file="${ejbca.plugin.property.file}"/>
<fail message="File '${ejbca.plugin.property.file}' lacks a property setting for 'plugin.ejbca.lib.dir'!">
<condition>
<not>
<isset property="plugin.ejbca.lib.dir"/>
</not>
</condition>
</fail>
<copy todir="${ejbca.plugin.gen.path}/lib">
<fileset dir="${plugin.ejbca.lib.dir}">
<include name="*.jar" />
</fileset>
</copy>
</target>
<target name="build-one-plugin-from-source" unless="pluginIsJarBased">
<echo message="Processing plugin file: '${ejbca.plugin.property.file}'"/>
<property file="${ejbca.plugin.property.file}"/>
<fail message="File '${ejbca.plugin.property.file}' lacks a property setting for 'plugin.ejbca.ant.file'!">
<condition>
<not>
<isset property="plugin.ejbca.ant.file"/>
</not>
</condition>
</fail>
<path id="ejbca.plugin.classpath">
<fileset dir="${lib}">
<include name="*.jar"/>
</fileset>
<fileset dir="${ejbca.home}/modules/dist">
<include name="*.jar"/>
</fileset>
<fileset dir="${dist.dir}">
<include name="*.jar"/>
</fileset>
<path refid="lib.ejbca-common-web.classpath"/>
<path refid="lib.log4j.classpath"/>
<path refid="lib.servlet.classpath"/>
<path refid="lib.commons-lang.classpath"/>
<path refid="lib.commons-fileupload.classpath"/>
<path refid="lib.jee.classpath"/>
<path refid="lib.bouncycastle.classpath"/>
<path refid="lib.ldap.classpath"/>
</path>
<delete dir="${ejbca.plugin.tmp.path}"/>
<mkdir dir="${ejbca.plugin.tmp.path}"/>
<script language="javascript"> <![CDATA[
var antcall = project.createTask ("ant");
// The minimum configuration: a path to an "ant" build file
antcall.setAntfile (project.getProperty ("plugin.ejbca.ant.file"));
// Check for possible non-default "ant" target
var build_target = project.getProperty ("plugin.ejbca.ant.target");
if (build_target != null) {
antcall.setTarget (build_target);
}
// Check for possible custom properties
var properties = project.getProperties ();
var keys = properties.keys ();
while (keys.hasMoreElements ()) {
var key = keys.nextElement ();
if (key.startsWith ("plugin.ejbca.ant.custom.")) {
var custom_prop = antcall.createProperty ();
custom_prop.setName (key);
custom_prop.setValue (properties.get (key));
}
}
// The class-path to it all
var myref = new org.apache.tools.ant.taskdefs.Ant.Reference ();
myref.setRefId ("ejbca.plugin.classpath");
var prop = antcall.createProperty ();
prop.setName ("ejbca.classpath");
prop.setRefid (myref);
// The full path to "application.xml"
prop = antcall.createProperty ();
prop.setName ("ejbca.app.xml");
prop.setValue (project.getProperty ("eardd.src") + "/META-INF/application.xml");
// The database type in case the plugin wants to extend etc.
prop = antcall.createProperty ();
prop.setName ("ejbca.dbtype");
prop.setValue (project.getProperty ("database.name"));
// The datasource for using with persistence.xml (hibernate)
prop = antcall.createProperty ();
prop.setName ("ejbca.datasource");
prop.setValue (project.getProperty ("datasource.jndi-name-prefix") + project.getProperty ("datasource.jndi-name"));
// The hibernate dialect in case the plugin wants to use hibernate.
prop = antcall.createProperty ();
prop.setName ("ejbca.hibernate");
prop.setValue (project.getProperty ("hibernate.dialect"));
// The path to generate code to
prop = antcall.createProperty ();
prop.setName ("ejbca.gen.path");
prop.setValue (project.getProperty ("ejbca.plugin.gen.path"));
// A path to use as you like
prop = antcall.createProperty ();
prop.setName ("ejbca.tmp.path");
prop.setValue (project.getProperty ("ejbca.plugin.tmp.path"));
// The path to the EJBCA install directory
prop = antcall.createProperty ();
prop.setName ("ejbca.home");
prop.setValue (project.getProperty ("ejbca.home"));
// Remove all properties the plugin doesn't need...
antcall.setInheritAll (false);
antcall.setInheritRefs (false);
antcall.perform ();
]]> </script>
</target>
<target name="plugin-bootstrap-build" if="ejbca.plugin.collection">
<!-- Called once immediately before "ejbca.ear" creation if there are any plugins to build -->
<echo message="Plugins found!"/>
<mkdir dir="${ejbca.plugin.gen.path}/lib"/>
<script language="javascript"> <![CDATA[
var path = project.getProperty ("ejbca.plugin.collection");
// Build one plugin at a time
while (path != null) {
var i = path.indexOf (java.io.File.pathSeparatorChar);
var plugin_file = path;
if (i > 0) {
plugin_file = path.substring (0, i);
path = path.substring (i + 1);
} else {
path = null;
}
var antcall = project.createTask ("antcall");
antcall.setTarget ("build-one-plugin");
var prop = antcall.createParam ();
prop.setName ("ejbca.plugin.property.file");
prop.setValue (plugin_file);
antcall.perform ();
}
]]> </script>
</target>
<target name="va_replacings_in_application.xml">
<war-replacement-in-module
replacement-tag="[email protected]@-->"
replacement-file="${application.xml}"
replacement-enabled="${status.war.enabled}"
replacement-web-uri="status.war"
replacement-context-root="${ocsp.contextroot}"
/>
<war-replacement-in-module
replacement-tag="[email protected]@-->"
replacement-file="${application.xml}"
replacement-enabled="${certstore.enabled}"
replacement-web-uri="certstore.war"
replacement-context-root="${certstore.contextroot}"
/>
<war-replacement-in-module
replacement-tag="[email protected]@-->"
replacement-file="${application.xml}"
replacement-enabled="${crlstore.enabled}"
replacement-web-uri="crlstore.war"
replacement-context-root="${crlstore.contextroot}"
/>
</target>
<!-- =================================================================== -->
<!-- Build CA-ear -->
<!-- =================================================================== -->
<target name="ejbca.ear" depends="display-properties, ejbca.ear.module-dependencies, create-log4config-bundle">
<antcall target="doc.war" inheritall="true" inheritrefs="true"><param name="docs.external-deps-satfisfied" value="isset"/></antcall>
<!-- This is quite ugly, we use two variables in order to decide if the systemtest files will be
included in the ear file or not. In ant 1.8 we could us an "if" to the "include" directive,
and only need one variable, but that does not work in ant 1.7 so... -->
<condition property="in-test-mode" else="false">
<equals arg1="${ejbca.productionmode}" arg2="false" casesensitive="false"/>
</condition>
<condition property="in-test-mode-include" value="" else="dontinclude/">
<equals arg1="${ejbca.productionmode}" arg2="false" casesensitive="false"/>
</condition>
<echo message="in-test-mode: ${in-test-mode}"/>
<property name="caear" value="${dist.dir}/ejbca.ear" />
<property name="eardd.src" value="${tmp}/ear" />
<!-- Make sure we have an application.xml since we want to specify base URLs. Configure enabled modules. -->
<mkdir dir="${eardd.src}/META-INF"/>
<copy todir="${eardd.src}/META-INF" file="src/deploy/ear/META-INF/application.xml" overwrite="true" flatten="true" failonerror="true"/>
<!-- Currently (2013-08) for JBoss 6, include a user defined log4j.xml in META-INF for per-deployment log configuration, re-usable for other appservers using the appserver.subtype var. -->
<copy overwrite="true" todir="${eardd.src}/META-INF" failonerror="false">
<fileset dir="${ejbca.home}/conf">
<include name="log4j-${appserver.subtype}.xml"/>
</fileset>
<mapper type="regexp" from="log4j-.*" to="log4j.xml"/>
</copy>
<war-replacement-in-module
replacement-tag="[email protected]@-->"
replacement-file="${eardd.src}/META-INF/application.xml"
replacement-enabled="${doc.war.enabled}"
replacement-web-uri="doc.war"
replacement-context-root="/ejbca/doc"
/>
<war-replacement-in-module
replacement-tag="[email protected]@-->"
replacement-file="${eardd.src}/META-INF/application.xml"
replacement-enabled="${web.renewalenabled}"
replacement-web-uri="renew.war"
replacement-context-root="/ejbca/renew"
/>
<jar-replacement-in-module
replacement-tag="[email protected]@-->"
replacement-file="${eardd.src}/META-INF/application.xml"
replacement-enabled="${ejbcaws.enabled}"
replacement-ejb="ejbca-ws-ejb.jar"
/>
<jar-replacement-in-module
replacement-tag="[email protected]@-->"
replacement-file="${eardd.src}/META-INF/application.xml"
replacement-enabled="${in-test-mode}"
replacement-ejb="systemtests-ejb.jar"
/>
<jar-replacement-in-module
replacement-tag="[email protected]@-->"
replacement-file="${eardd.src}/META-INF/application.xml"
replacement-enabled="${mod.statedump.exists}"
replacement-ejb="statedump-ejb.jar"
/>
<jar-replacement-in-module
replacement-tag="[email protected]@-->"
replacement-file="${eardd.src}/META-INF/application.xml"
replacement-enabled="${mod.configdump.exists}"
replacement-ejb="configdump-ejb.jar"
/>
<jar-replacement-in-module
replacement-tag="[email protected]@-->"
replacement-file="${eardd.src}/META-INF/application.xml"
replacement-enabled="${mod.peerconnector.exists}"
replacement-ejb="peerconnector-ejb.jar"
/>
<jar-replacement-in-module
replacement-tag="[email protected]@-->"
replacement-file="${eardd.src}/META-INF/application.xml"
replacement-enabled="${mod.cesecore-cvcca.exists}"
replacement-ejb="cesecore-cvcca.jar"
/>
<jar-replacement-in-module
replacement-tag="[email protected]@-->"
replacement-file="${eardd.src}/META-INF/application.xml"
replacement-enabled="${mod.cesecore-x509ca.exists}"
replacement-ejb="cesecore-x509ca.jar"
/>
<jar-replacement-in-module
replacement-tag="[email protected]@-->"
replacement-file="${eardd.src}/META-INF/application.xml"
replacement-enabled="${mod.unidfnr.enabled}"
replacement-ejb="unidfnr-ejb.jar"
/>
<connector-replacement-in-module
replacement-tag="[email protected]@-->"
replacement-file="${eardd.src}/META-INF/application.xml"
replacement-enabled="${mod.peerconnector-rar.exists}"
replacement-connector="peerconnector.rar"
/>
<war-replacement-in-module
replacement-tag="[email protected]@-->"
replacement-file="${eardd.src}/META-INF/application.xml"
replacement-enabled="${mod.peerconnector.exists}"
replacement-web-uri="peerconnector.war"
replacement-context-root="/ejbca/peer"
/>
<war-replacement-in-module
replacement-tag="[email protected]@-->"
replacement-file="${eardd.src}/META-INF/application.xml"
replacement-enabled="${variant.ra.enabled}"
replacement-web-uri="ra-gui.war"
replacement-context-root="/ejbca/ra"
/>
<war-replacement-in-module
replacement-tag="[email protected]@-->"
replacement-file="${eardd.src}/META-INF/application.xml"
replacement-enabled="${mod.acme.exists}"
replacement-web-uri="acme.war"
replacement-context-root="/ejbca/acme"
/>
<war-replacement-in-module
replacement-tag="[email protected]@-->"
replacement-file="${eardd.src}/META-INF/application.xml"
replacement-enabled="${mod.msae.exists}"
replacement-web-uri="msae.war"
replacement-context-root="/ejbca/msae"
/>
<war-replacement-in-module
replacement-tag="[email protected]@-->"
replacement-file="${eardd.src}/META-INF/application.xml"
replacement-enabled="${mod.est.exists}"
replacement-web-uri="est.war"
replacement-context-root="/.well-known/est"
/>
<war-replacement-in-module
replacement-tag="[email protected]@-->"
replacement-file="${eardd.src}/META-INF/application.xml"
replacement-enabled="${mod.ejbca-rest-api.exists}"
replacement-web-uri="ejbca-rest-api.war"
replacement-context-root="/ejbca/ejbca-rest-api"
/>
<war-replacement-in-module
replacement-tag="[email protected]@-->"
replacement-file="${eardd.src}/META-INF/application.xml"
replacement-enabled="${swagger-ui.exists}"
replacement-web-uri="swagger-ui.war"
replacement-context-root="/ejbca/swagger-ui"
/>
<war-replacement-in-module
replacement-tag="[email protected]@-->"
replacement-file="${eardd.src}/META-INF/application.xml"
replacement-enabled="${mod.ssh.exists}"
replacement-web-uri="ssh.war"
replacement-context-root="/ejbca/ssh"
/>
<antcall target="va_replacings_in_application.xml" inheritall="true" inheritrefs="true">
<param name="application.xml" value="${eardd.src}/META-INF/application.xml"/>
</antcall>
<!-- This dir has to exist here -->
<mkdir dir="${hwtoken.class.dir}"/>
<!-- Include Hibernate JPA libraries if they don't exist in the current application server. -->
<condition property="bundle-hibernate-exclude" value="" else="**">
<isset property="bundle-hibernate-jpa"/>
</condition>
<!-- Include Xerces library if it don't exist in the current application server (jboss6 won't start with it). -->
<condition property="bundle-xerces-exclude" value="xerces*.jar, xml-apis.jar" else="">
<isset property="exclude-xerces"/>
</condition>
<!-- Special JBoss EAP 6 handling -->
<condition property="jbosseap6-specials" value="true"><equals arg1="jbosseap6" arg2="${appserver.subtype}"/></condition>
<!-- Remove possible "leftovers" from previous plugin runs! -->
<delete dir="${ejbca.plugin.gen.path}"/>
<!-- Plugin build starts here... -->
<antcall target="plugin-bootstrap-build" inheritall="true" inheritrefs="true"/>
<!-- Build the EAR -->
<ear destfile="${caear}" appxml="${eardd.src}/META-INF/application.xml">
<!-- Add other specific files we need in META-INF -->
<zipfileset prefix="META-INF" dir="${eardd.src}/META-INF" includes="log4j.xml"/>
<!-- Specify that we will use a specific WS implementation -->
<zipfileset prefix="META-INF/services" dir="${ejbca.home}/src/deploy/ear/META-INF/services/" includes="javax.xml.soap.MetaFactory"/>
<!-- Add application server specific XML files -->
<zipfileset prefix="META-INF" dir="${ejbca.home}/src/deploy/ear/META-INF" includes="jboss-deployment-structure.xml"/>
<!-- The place where to find plugins -->
<zipfileset dir="${ejbca.plugin.gen.path}" erroronmissingdir="false"/>
<zipfileset prefix="lib" dir="${lib}">
<include name="bcpkix-jdk15on-*.jar"/>
<include name="bcprov-jdk15on-*.jar"/>
<include name="bctls-jdk15on-*.jar"/>
<include name="bcutil-jdk15on-*.jar"/>
<include name="cert-cvc-*.jar" />
<!-- JBoss EAP 6 comes with a new Log4j and there may be issues if we bundle it. -->
<include name="log4j-*.jar" unless="jbosseap6-specials"/>
<include name="ldap.jar" />
<include name="adsddl-*.jar"/>
<include name="commons-*.jar" />
<include name="nimbus-jose-jwt-*.jar"/>
<include name="json-smart-*.jar"/>
<include name="httpclient-*.jar" />
<include name="httpcore-*.jar" />
<include name="httpmime-*.jar" />
<include name="json-simple-*.jar" />
<include name="jcip-annotations-*.jar" />
<include name="snakeyaml-*.jar" />
<include name="dns*.jar" />
<include name="guava-*.jar" />
<include name="jsch-*.jar" />
<include name="jna-*.jar"/>
</zipfileset>
<zipfileset prefix="lib" dir="${lib}/ct" erroronmissingdir="false">
<!-- Certificate Transparency -->
<include name="ctlog-*.jar" />
<include name="protobuf-java-*.jar" />
</zipfileset>
<!-- Swagger is included in each module.war/WEB-INF/lib/ instead,
since it is not designed for multiple APIs in the same class loader.
<zipfileset prefix="lib" dir="${lib}/ext/swagger" erroronmissingdir="false" includes="*.jar"/>
-->
<zipfileset prefix="lib" dir="${lib}/ext/jackson2" erroronmissingdir="false">
<include name="jackson-annotations-2.*.jar"/>
<include name="jackson-core-2.*.jar"/>
<include name="jackson-databind-2.*.jar"/>
<include name="jackson-dataformat-yaml-2.*.jar"/>
</zipfileset>
<zipfileset prefix="lib" dir="${lib}/intune" erroronmissingdir="false">
<include name="accessors-smart-*.jar"/>
<include name="adal4j-*.jar"/>
<include name="asm-*.jar"/>
<include name="content-type-*.jar"/>
<include name="csr-validation-*.jar"/>
<include name="gson-*.jar"/>
<include name="json-*.jar"/>
<include name="lang-tag-*.jar"/>
<include name="oauth2-oidc-sdk-*.jar"/>
</zipfileset>
<zipfileset prefix="lib" dir="${lib}/batik" includes="*.jar" excludes="${bundle-xerces-exclude}"/>
<fileset dir="${dist.dir}" includes="doc*.war"/>
<fileset dir="${ejbca.home}/modules/dist">
<include name="cesecore-ejb.jar" />
<include name="ejbca-ejb.jar" />
<include name="edition-specific-ejb.jar" />
<include name="ejbca-ws-ejb.jar" />
<include name="adminweb.war" />
<include name="cmp.war" />
<include name="publicweb.war" />
<include name="scep.war" />
<include name="est.war" />
<include name="healthcheck.war" />
<include name="clearcache.war" />
<include name="webdist.war" />
<include name="status.war" />
<include name="certstore.war" />
<include name="crlstore.war" />
<include name="renew.war" />
<include name="${in-test-mode-include}systemtests-ejb.jar"/>
<include name="statedump-ejb.jar" />
<include name="configdump-ejb.jar" />
<include name="peerconnector.rar" />
<include name="peerconnector.war" />
<include name="peerconnector-ejb.jar" />
<include name="unidfnr-ejb.jar" />
<include name="ra-gui.war" />
<include name="ejbca-rest-api.war"/>
<include name="acme.war" />
<include name="${in-test-mode-include}systemtests-common.jar"/>
<include name="ssh.war" />
<include name="msae.war" />
</fileset>
<fileset dir="${ejbca.home}/lib/swagger">
<include name="swagger-ui.war" />
</fileset>
<zipfileset prefix="lib" dir="${ejbca.home}/modules/dist">
<include name="externalra-service.jar" />
<include name="ejbca-common-web.jar" />
<include name="ejbca-interface.jar" />
<include name="ejbca-entity.jar" />
<include name="ejbca-ws.jar" />
<include name="cesecore-ejb-interface.jar" />
<include name="cesecore-common.jar" />
<include name="cesecore-entity.jar" />
<include name="cesecore-x509ca.jar" />
<include name="cesecore-cvcca.jar" />
<include name="ejbca-extensions.jar" />
<include name="ejbca-properties.jar" />
<include name="log4jconfig.jar" unless="jbosseap6-specials"/>
<include name="jbosslog4jsafer.jar" if="jbosseap6-specials"/>
<include name="${in-test-mode-include}systemtests-interfaces.jar"/>
<include name="${in-test-mode-include}systemtests-common.jar"/>
<include name="ct.jar" />
<include name="edition-specific-interface.jar" />
<include name="edition-specific-ejb.jar" />
<include name="statedump-common.jar" />
<include name="configdump-common.jar" />
<include name="peerconnector-ra.jar" />
<include name="peerconnector-publ.jar" />
<include name="peerconnector-interface.jar" />
<include name="peerconnector-common.jar" />
<include name="peerconnector-entity.jar" />
<include name="plugins-ee.jar" />
<include name="caa.jar" />
<include name="unidfnr-ejb.jar" />
<include name="ejbca-ejb.jar" />
<include name="acme-common.jar" />
<include name="ejbca-rest-common.jar" />
<include name="ejbca-rest-cryptotoken.jar" />
<include name="ejbca-rest-camanagement.jar" />
<include name="ejbca-rest-endentity.jar" />
<include name="ejbca-ssh.jar" />
</zipfileset>
<!-- Include XStream for the use from statedump-ejb.jar -->
<zipfileset prefix="lib" dir="${lib}/xstream" erroronmissingdir="false">
<include name="*.jar"/>
</zipfileset>
<!-- Include JackNji11 for use from P11NG (cesecore-common) -->
<zipfileset prefix="lib" dir="${lib}" includes="jacknji11-*.jar"/>
<zipfileset prefix="lib" dir="${mod.dist.path}">
<!-- ejbca-ws-client is needed for automatic OCSP Renewal via WS
There are classpath issues using the ejbca-ws-cli.jar though, since this jar contain class-patch in META-INF/MANIFEST
and the appserver wants to manage the classpath when running in an ear, therefore we have a ejbca-ws-client.jar, that is the
same as the ejbca-ws-cli.jar, except there is no classpath and mainclass in the META-INF/MANIFEST file. -->
<include name="${mod.ejbca-ws-client.libname}" />
</zipfileset>
<zipfileset prefix="lib" dir="${lib}/hibernate" excludes="${bundle-hibernate-exclude}"/>
<zipfileset prefix="lib" dir="${dist.dir}" includes="ejbca-common.jar"/>
<!-- Include PrimeCard HSM libraries. TODO: Test that this works. Previously the classes were included in ejbca-ejb.jar.. -->
<zipfileset prefix="lib" dir="${hwtoken.class.dir}" includes="*.jar"/>
</ear>
<antcall target="signjar" inheritall="true" inheritrefs="true">
<param name="signjar.file" value="${caear}"/>
</antcall>
</target>
<target name="create-log4config-bundle">
<mkdir dir="tmp"/>
<!-- For appservers that don't come with Log4J we need to bundle a configuration file in the classpath (in the EARs lib/ directory in a JAR) -->
<copy overwrite="true" todir="tmp" failonerror="false">
<fileset dir="${ejbca.home}/conf">
<include name="log4j-${appserver.type}.xml.sample"/>
</fileset>
<mapper type="regexp" from="log4j-.*" to="log4j.xml"/>
</copy>
<copy overwrite="true" todir="tmp" failonerror="false">
<fileset dir="${ejbca.home}/conf">
<include name="log4j-${appserver.type}.xml"/>
</fileset>
<mapper type="regexp" from="log4j-.*" to="log4j.xml"/>
</copy>
<!-- If we don't have a specific file for an appserver, perhaps we have one for the subtype (i.e. jboss and jboss6) -->
<copy overwrite="true" todir="tmp" failonerror="false">
<fileset dir="${ejbca.home}/conf">
<include name="log4j-${appserver.subtype}.xml.sample"/>
</fileset>
<mapper type="regexp" from="log4j-.*" to="log4j.xml"/>
</copy>
<copy overwrite="true" todir="tmp" failonerror="false">
<fileset dir="${ejbca.home}/conf">
<include name="log4j-${appserver.subtype}.xml"/>
</fileset>
<mapper type="regexp" from="log4j-.*" to="log4j.xml"/>
</copy>
<jar destfile="modules/dist/log4jconfig.jar" whenempty="skip" basedir="tmp" includes="log4j.xml"/>
<delete file="tmp/log4j.xml"/>
</target>
<!-- =================================================================== -->
<!-- Build Javadoc part -->
<!-- =================================================================== -->
<target name="javadoc" description="Build JavaDoc for all modules" depends="deprecated:check">
<mkdir dir="${apidoc}" />
<path id="javadoc-dependencies.classpath">
<fileset dir="${lib}" includes="**/*.jar"/>
<fileset dir="${ant.home}/lib/" includes="ant.jar"/>
</path>
<!-- extdirs="${lib}" -->
<javadoc packagenames="org.ejbca.*,org.cesecore.*" maxmemory="256m" destdir="${apidoc}" classpathref="javadoc-dependencies.classpath"
author="true" version="true" use="true" windowtitle="EJBCA API" bottom="Copyright © PrimeKey Solutions AB." >
<sourcepath location="${ejbca.home}/modules/cesecore-common/src"/>
<sourcepath location="${ejbca.home}/modules/cesecore-cvcca/src"/>
<sourcepath location="${ejbca.home}/modules/cesecore-ejb/src"/>
<sourcepath location="${ejbca.home}/modules/cesecore-ejb-interface/src"/>
<sourcepath location="${ejbca.home}/modules/cesecore-entity/src"/>
<sourcepath location="${ejbca.home}/modules/cesecore-x509ca/src"/>
<sourcepath location="${ejbca.home}/modules/cli-util/src"/>
<sourcepath location="${ejbca.home}/modules/clientToolBox/src"/>
<sourcepath location="${ejbca.home}/modules/edition-specific/src-ejb/"/>
<sourcepath location="${ejbca.home}/modules/edition-specific/src-interface/"/>
<sourcepath location="${ejbca.home}/modules/edition-specific-ee/src-ejb/"/>
<sourcepath location="${ejbca.home}/modules/ejbca-common/src/"/>
<sourcepath location="${ejbca.home}/modules/ejbca-common-web/src/"/>
<sourcepath location="${ejbca.home}/modules/ejbca-ejb/src/"/>
<sourcepath location="${ejbca.home}/modules/ejbca-ejb-cli/src"/>
<sourcepath location="${ejbca.home}/modules/ejbca-entity/src"/>
<sourcepath location="${ejbca.home}/modules/ejbca-ejb-interface/src"/>
<sourcepath location="${ejbca.home}/modules/ejbca-ws/src"/>
<sourcepath location="${ejbca.home}/modules/ejbca-ws-cli/src"/>
<sourcepath location="${ejbca.home}/modules/ejbca-ws-cli/src-gen"/>
<sourcepath location="${ejbca.home}/modules/externalra-scep/src"/>
<sourcepath location="${ejbca.home}/modules/externalra/src"/>
<sourcepath location="${ejbca.home}/modules/peerconnector/src-cli"/>
<sourcepath location="${ejbca.home}/modules/peerconnector/src-common"/>
<sourcepath location="${ejbca.home}/modules/peerconnector/src-ejb"/>
<sourcepath location="${ejbca.home}/modules/peerconnector/src-interface"/>
<sourcepath location="${ejbca.home}/modules/peerconnector/src-publ"/>
<sourcepath location="${ejbca.home}/modules/peerconnector/src-rar"/>
<sourcepath location="${ejbca.home}/modules/peerconnector/src-war"/>
<sourcepath location="${ejbca.home}/modules/peerconnector/src-ra"/>
<sourcepath location="${ejbca.home}/modules/va/src-war"/>
<sourcepath location="${ejbca.home}/modules/va/publisher/src"/>
</javadoc>
<echo message=""/>
<dirname file="${apidoc}/index.html" property="javadoc.dir"/>
<echo message="EJBCA API is available in file://${javadoc.dir}/index.html"/>
</target>
<!-- ========================================================================== -->
<!-- Upgrades the database for a new version of ejbca -->
<!-- ========================================================================== -->
<target name="upgrade" description="Run post-upgrade operations">
<java dir="${ejbca.home}" jar="${ejbca.home}/dist/ejbca-ejb-cli/ejbca-ejb-cli.jar" fork="true">
<arg line="upgrade"/>
</java>
</target>
<!-- ================================================================ -->
<!-- Prompts for the database password if it has not been set already -->
<!-- ================================================================ -->
<target name="inputDatabasePassword" >
<input message="Please enter the password to the database. Default works for H2." addproperty="database.password" defaultvalue="sa">
<handler classname="org.apache.tools.ant.input.SecureInputHandler" />
</input>
</target>
<!-- ========================================================================== -->
<!-- Promts for truststore/keystore passwords if they have not been set already -->
<!-- Note: This code is duplicated in cli.xml!!!! -->
<!-- ========================================================================== -->
<target name="inputKeystorePassword">
<input message="Please enter the password of the truststore with the CA certificate for https?" addproperty="java.trustpassword" defaultvalue="changeit">
<handler classname="org.apache.tools.ant.input.SecureInputHandler" />
</input>
<input message="Please enter the password of the keystore with the TLS key for https" addproperty="httpsserver.password" defaultvalue="serverpwd">
<handler classname="org.apache.tools.ant.input.SecureInputHandler" />
</input>
</target>
<!-- ======================================================================= -->
<!-- Deploy EJBCA ear to JBoss -->
<!-- ======================================================================= -->
<!-- Check if there exist a dist/ejbca.ear, if it exists deployear can just deploy it directly, if not we have to build it before deployear can deploy it -->
<target name="checkearexists">
<condition property="ejbcaear.built">
<available file="${dist.dir}/ejbca.ear" type="file"/>
</condition>
</target>
<target name="buildifnotbuilt" depends="checkearexists" unless="ejbcaear.built">
<antcall target="build" inheritall="true" inheritrefs="true"/>
</target>
<target name="deploy" description="'ant deploy' is a deprecated target from outdated installation instructions, please use updated installation guides and the 'deployear' target">
<echo message="'ant deploy' is a deprecated target from outdated installation instructions, please use updated installation guides and the 'deployear' target"/>
</target>
<target name="deployear" depends="buildifnotbuilt" description="Deploy the EJBCA application (ejbca.ear) without building and without deploying datasources or any configuration">
<fail message="File '${dist.dir}/ejbca.ear' to deploy does not exist. You must build the file using the 'ant' command.">
<condition>
<not>
<available file="${dist.dir}/ejbca.ear" type="file"/>
</not>
</condition>
</fail>
<antcall target="jee:deployear" />
<antcall target="showtime" inheritall="true" inheritrefs="true"/>
</target>
<!-- ======================================================================= -->
<!-- Deploy the keystores to the application server. -->
<!-- ======================================================================= -->
<target name="deploy-keystore" depends="deprecated:check" description="Deploy the keystore and truststore for the application server.">
<antcall target="jee:keystore" />
</target>
<!-- ======================================================================= -->
<!-- Deploy the datasources to the application server. -->
<!-- ======================================================================= -->
<target name="deploy-datasource" depends="deprecated:check" description="Deploy the datasources for the application server.">
<antcall target="jee:deployDS" />
<antcall target="jee:deployOCSPDS" />
</target>
<!-- ======================================================================= -->
<!-- Deploy the services to the application server. -->
<!-- ======================================================================= -->
<target name="deploy-service" depends="deprecated:check" description="Deploy the services for the application server.">
<antcall target="jee:deployServices" />
</target>
<target name="deploy-test" depends="failinproduction,build, inputDatabasePassword, inputKeystorePassword, deprecated:check" description="Deploy a test version of EJBCA.">
<!-- Build the test EAR -->
<antcall target="jee:deployTestEar"/>
</target>
<!-- ======================================================================= -->
<!-- Renew the keystore used by the web interface on the application server. -->
<!-- ======================================================================= -->
<target name="renew-keystore" depends="inputKeystorePassword, deprecated:check" description="Renews the keystore for the application server web interface. Don't forget to deploy the new keystore afterwards. The old keystore in p12/tomcat.jks will be overwritten.">
<ant dir="${ejbca.home}/bin" antfile="cli.xml" target="ejbca:renew-keystore" />
</target>
<!-- ======================================================================= -->
<!-- Make a ZIP release file of EJBCA, and a SHA1 checksum of the release -->
<!-- The ZIP file contains all the files used, but not temporary or compile files etc -->
<!-- ======================================================================= -->
<property name="edition" value="ce"/> <!-- ce if edition not set on command line with -Dedition=xyz" -->
<property name="variant" value=""/> <!-- If we are running on a full EJBCA instance! -->
<!-- This property is used to distinguish if we are running in full EJBCA or on a VA/RA only instance. To exclude parts from ejbca.sh accordingly -->
<condition property="running.full.ejbca" value="true">
<and>
<not><equals arg1="${variant}" arg2="ra" casesensitive="false"/></not>
<not><equals arg1="${variant}" arg2="va" casesensitive="false"/></not>
</and>
</condition>
<!-- Allows overruling the documentation generation for ziprelease. This is needed for Jenkins jobs, because confluence is not accessible from inside Jenkins.
Default value (when you don't specify the -Ddoc.update flag at all) is TRUE -->
<condition property="doc.update.ziprelease" value="true">
<not><equals arg1="${doc.update}" arg2="false"/></not>
</condition>
<target name="ziprelease" depends="deprecated:check" description="Make a zip file for EJBCA release. -Dedition=ee or ce (default) -Dvariant='ra', 'va' or 'eidas'">
<antcall target="clean" />
<!-- Always retrieve current version from Confluence -->
<antcall target="doc" inheritAll="true">
<param name="update.from.confluence" value="${doc.update.ziprelease}"/>
<param name="doc.update" value="${doc.update.ziprelease}"/>
</antcall>
<!-- Copy the retrieved documentation from the tmp/docs directory into doc/dist for the sake of this release-->
<copy todir="doc/dist" overwrite="true">
<fileset dir="tmp/htdocs/docs" includes="**/*" excludes="**/jquery.min.js"/>
</copy>
<!-- A small script that converts the version x.y.z to x_y_z to be used in the file. JavaScript does not work under Java 1.5. -->
<scriptdef name="convertdot" language="javascript">
<![CDATA[
ver = project.getProperty("app.version.number");
// We have to "cast" ver to a javascript string to avoid errors in JDK about "is ambiguous"
relstring = (ver+"").replace(/\./g,'_');
//self.log(ver);
//self.log(relstring);
project.setProperty("ejbca.zipversion", relstring);
str = project.getProperty("ejbca.zipversion");
]]>
</scriptdef>
<antcall target="update-gitrev" /> <!-- update git revision version property -->
<antcall target="update-edition" />
<condition property="edition.is.ee" value="true">
<equals arg1="${edition}" arg2="ee" casesensitive="true"/>
</condition>
<condition property="build.contains.eidas">
<equals arg1="${variant}" arg2="eidas" casesensitive="false"/>
</condition>
<condition property="build.contains.va" value="true">
<not><equals arg1="${variant}" arg2="ra" casesensitive="false"/></not>
</condition>
<condition property="build.contains.ra" value="true">
<not><equals arg1="${variant}" arg2="va" casesensitive="false"/></not>
</condition>
<condition property="build.contains.ssh" value="true">
<equals arg1="${variant}" arg2="ssh" casesensitive="false"/>
</condition>
<condition property="build.contains.cesecore-x509ca" value="true">
<istrue value="${running.full.ejbca}" />
</condition>
<condition property="build.contains.cesecore-cvcca" value="true">
<and>
<equals arg1="${edition}" arg2="ee" casesensitive="true"/>
<istrue value="${running.full.ejbca}" />
</and>
</condition>
<condition property="variant.suffix" value="_RA">
<equals arg1="${variant}" arg2="ra" casesensitive="false"/>
</condition>
<condition property="variant.suffix" value="_VA">
<equals arg1="${variant}" arg2="va" casesensitive="false"/>
</condition>
<condition property="variant.suffix" value="_eIDAS">
<equals arg1="${variant}" arg2="eidas" casesensitive="false"/>
</condition>
<condition property="variant.suffix" value="_SSH">
<equals arg1="${variant}" arg2="ssh" casesensitive="false"/>
</condition>
<condition property="variant.suffix" value="">
<istrue value="${running.full.ejbca}" />
</condition>
<!-- Pre-configure eIDAS edition only to use P11NG with CP5 additions -->
<copy file="src/java/defaultvalues.properties" tofile="${tmp}/eidas/src/java/defaultvalues.properties" overwrite="true">
<filterchain>
<tokenfilter>
<replacestring from="#sunp11.cryptotoken.enabled=false" to="sunp11.cryptotoken.enabled=false"/>
</tokenfilter>
<tokenfilter>
<replacestring from="#p11ng.cryptotoken.enabled=true" to="p11ng.cryptotoken.enabled=true"/>
</tokenfilter>
<tokenfilter>
<replacestring from="#p11ng.utimacocp5.enabled=true" to="p11ng.utimacocp5.enabled=true"/>