-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmaven.xml
760 lines (728 loc) · 33.1 KB
/
maven.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
<project name="maven" default="nexus.install" xmlns:aether="antlib:org.sonatype.aether.ant" xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:artifact="antlib:org.apache.maven.artifact.ant" basedir=".">
<!--
<property name="mvn.type" value="snapshot" />
<property name="mvn.type" value="release" />
<property name="mvn.repo.dest" value="remote" />
<property name="mvn.repo.dest" value="local" />
<property name="mvn.repo.id" value="mvn.repo.${mvn.repo.dest}" />
<property name="maven.repo.local" location="${pub.dir}/maven2" />
-->
<property name="maven.ant.tasks.jar" value="${cfdistro.lib.dir}/maven-ant-tasks-2-1-3-1.0.0.0.jar" />
<path id="maven.ant.tasks.classpath" path="${maven.ant.tasks.jar}" />
<antcontrib:if>
<available file="${maven.ant.tasks.jar}" /><then/>
<else>
<ant-set-log-level level="0"/>
<get src="http://cfmlprojects.org/artifacts/cfdistro/lib/maven-ant-tasks-2-1-3/1.0.0.0/maven-ant-tasks-2-1-3-1.0.0.0.jar" dest="${maven.ant.tasks.jar}" skipexisting="true" />
<ant-set-log-level level="2"/>
</else>
</antcontrib:if>
<taskdef resource="org/apache/maven/artifact/ant/antlib.xml" uri="antlib:org.apache.maven.artifact.ant" classpathref="maven.ant.tasks.classpath" />
<!-- This will initialize all the maven ant tasks and download the requested artifact and its dependencies -->
<target name="get" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<taskdef-dependency name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" artifactId="xmltask-v1-16-1" groupId="cfdistro.lib" version="1.0.0.0" />
<path id="maven.ant.tasks.classpath" path="${maven.ant.tasks.jar}" />
<condition property="maven.repo.local" value="${maven.repo.local}" else="${user.home}/.m2/repository">
<isset property="maven.repo.local" />
</condition>
<echo>maven.repo.local=${maven.repo.local}</echo>
<artifact:localRepository id="local.repository" path="${maven.repo.local}" />
<artifact:dependencies pathId="build.classpath" sourcesFilesetId="sources.id">
<dependency groupId="${mvn.get.groupId}" artifactId="${mvn.get.artifactId}" version="${mvn.get.version}"/>
<localRepository refid="local.repository" />
</artifact:dependencies>
</target>
<macrodef name="mvn-repo">
<attribute name="id" />
<attribute name="url"/>
<element name="authentication" optional="true" />
<element name="enablement" optional="true" />
<sequential>
<artifact:remoteRepository id="@{id}" url="@{url}">
<authentication />
<enablement />
</artifact:remoteRepository>
</sequential>
</macrodef>
<macrodef name="mvn-get" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<attribute name="groupId" />
<attribute name="artifactId"/>
<attribute name="version"/>
<attribute name="classifier" default=""/>
<attribute name="type" default="zip"/>
<attribute name="scope" default="runtime" />
<attribute name="toFile" default=""/>
<attribute name="toDir" default=""/>
<attribute name="repoId" default="cfdistro.repo.remote" />
<element name="additional" implicit="true" optional="true"/>
<sequential>
<antcontrib:if>
<equals arg1="${dependencies.@{groupId}.@{artifactId}.@{version}.@{classifier}.@{type}}" arg2="@{groupId}:@{artifactId}:@{version}:@{classifier}:@{type}"/>
<then/><else>
<property name="dependencies.@{groupId}.@{artifactId}.@{version}.@{classifier}.@{type}" value="@{groupId}:@{artifactId}:@{version}:@{classifier}:@{type}" />
<echo message="Dependency: @{groupId}:@{artifactId}:@{version}:@{classifier}:@{type}"/>
</else>
</antcontrib:if>
<antcontrib:var unset="true" name="_dependency.fileset" />
<path id="maven.ant.tasks.classpath" path="${maven.ant.tasks.jar}" />
<artifact:dependencies filesetId="_dependency.fileset" pathId="classpath.@{groupId}.@{artifactId}" useScope="@{scope}">
<dependency groupId="@{groupId}" artifactId="@{artifactId}" version="@{version}" classifier="@{classifier}" type="@{type}">
<additional/>
</dependency>
<localRepository path="${cfdistro.repo.local.path}" />
<remoteRepository refid="cfdistro.repo.local" />
<remoteRepository refid="@{repoId}" />
</artifact:dependencies>
<antcontrib:if>
<equals arg1="@{toFile}" arg2="" />
<then/><else>
<antcontrib:propertyregex
property="dependency.location"
input="@{groupId}"
global="true" override="yes"
regexp="\."
replace="/" />
<copy tofile="@{toFile}" file="${cfdistro.repo.local.path}/${dependency.location}/@{artifactId}/@{version}/@{artifactId}-@{version}.@{type}" />
</else>
</antcontrib:if>
<antcontrib:if>
<equals arg1="@{toDir}" arg2="" /><then/>
<else>
<copy todir="@{toDir}">
<fileset refid="_dependency.fileset" />
<mapper type="flatten" />
</copy>
</else>
</antcontrib:if>
</sequential>
</macrodef>
<macrodef name="mvn-get-deps" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<attribute name="todir" />
<attribute name="scope" default="runtime" />
<attribute name="pomfile" default="" />
<element name="deps" implicit="true" optional="true"/>
<sequential>
<path id="maven.ant.tasks.classpath" path="${maven.ant.tasks.jar}" />
<antcontrib:var unset="true" name="_dependency.fileset" />
<antcontrib:if>
<equals arg1="@{pomfile}" arg2="" />
<then>
<artifact:dependencies filesetId="_dependency.fileset" useScope="@{scope}">
<deps />
<localRepository path="${cfdistro.repo.local.path}" />
<remoteRepository refid="cfdistro.repo.local" />
<remoteRepository refid="cfdistro.repo.remote" />
</artifact:dependencies>
</then>
<else>
<artifact:dependencies filesetId="_dependency.fileset" useScope="@{scope}">
<pom file="@{pomfile}"/>
<localRepository path="${cfdistro.repo.local.path}" />
<remoteRepository refid="cfdistro.repo.local" />
<remoteRepository refid="cfdistro.repo.remote" />
</artifact:dependencies>
</else>
</antcontrib:if>
<copy todir="@{todir}">
<fileset refid="_dependency.fileset" />
<mapper type="flatten" />
</copy>
</sequential>
</macrodef>
<macrodef name="dependency-location">
<attribute name="property" />
<attribute name="groupId" />
<attribute name="artifactId"/>
<attribute name="version"/>
<attribute name="classifier" default=""/>
<attribute name="type" default="zip"/>
<sequential>
<antcontrib:var name="dependency.location" value="@{groupId}"/>
<antcontrib:propertyregex
property="dependency.location"
input="@{groupId}"
global="true" override="yes"
regexp="\."
replace="/" />
<antcontrib:if>
<equals arg1="@{classifier}" arg2="" />
<then>
<antcontrib:var name="_dep.classifier" value=""/>
</then>
<else>
<antcontrib:var name="_dep.classifier" value="-@{classifier}"/>
</else>
</antcontrib:if>
<antcontrib:var name="@{property}" value="${cfdistro.repo.local.path}/${dependency.location}/@{artifactId}/@{version}/"/>
</sequential>
</macrodef>
<macrodef name="dependency">
<attribute name="groupId" />
<attribute name="artifactId"/>
<attribute name="version"/>
<attribute name="classifier" default=""/>
<attribute name="type" default="zip"/>
<attribute name="mapping" default=""/>
<attribute name="dest" default=""/>
<attribute name="unzip" default="true"/>
<attribute name="isExtension" default="false"/>
<attribute name="repoId" default="cfdistro.repo.remote" />
<element name="exclusions" implicit="false" optional="true"/>
<sequential>
<property name="ext.mappings.dir" value="${user.home}/cfdistro/ext/mappings" />
<dependency-location property="_dep.loc" groupId="@{groupId}" artifactId="@{artifactId}" version="@{version}" type="@{type}" classifier="@{classifier}"/>
<antcontrib:var name="_dep.file" value="${_dep.loc}/@{artifactId}-@{version}${_dep.classifier}.@{type}"/>
<mvn-get groupId="@{groupId}" artifactId="@{artifactId}" version="@{version}" type="@{type}" classifier="@{classifier}" toDir="@{dest}" repoId="@{repoId}">
<exclusions />
</mvn-get>
<antcontrib:if>
<equals arg1="@{dest}" arg2="" /><then/>
<else>
<antcontrib:if>
<equals arg1="true" arg2="@{unzip}" />
<then>
<unzip src="${_dep.file}" dest="@{dest}"/>
<delete file="@{dest}/@{artifactId}-@{version}${_dep.classifier}.@{type}" verbose="false"/>
</then>
<else>
<copy file="${_dep.file}" todir="@{dest}"/>
</else>
</antcontrib:if>
</else>
</antcontrib:if>
<antcontrib:if>
<equals arg1="@{mapping}" arg2="" />
<then/>
<else>
<antcontrib:if>
<equals arg1="${copy.mappings.to.src}" arg2="true" />
<then>
<unzip src="${_dep.file}" dest="${war.target.dir}/@{mapping}"/>
</then>
<else>
<antcontrib:if>
<equals arg1="@{dest}" arg2="" />
<then>
<antcontrib:var name="ext.mapping.dir" value="${ext.mappings.dir}/@{groupId}/@{artifactId}/@{version}" />
<antcontrib:var name="physicalxml" value="@ext.mappings.dir@/@{groupId}/@{artifactId}/@{version}" />
</then>
<else>
<antcontrib:var name="ext.mapping.dir" value="@{dest}" />
<antcontrib:var name="physicalxml" value="@{dest}" />
</else>
</antcontrib:if>
<antcontrib:if>
<available file="${ext.mapping.dir}"/><then/>
<else>
<unzip src="${_dep.file}" dest="${ext.mapping.dir}"/>
</else>
</antcontrib:if>
<!-- physicalxml is what goes in the mappings.xml file. a token vs. the fixed path. -->
<mapping physical="${ext.mapping.dir}" physicalxml="${physicalxml}" virtual="@{mapping}"/>
</else>
</antcontrib:if>
</else>
</antcontrib:if>
<antcontrib:if>
<equals arg1="@{isExtension}" arg2="true" />
<then>
<railo-extension-install extension-zip="${_dep.file}" />
</then>
</antcontrib:if>
</sequential>
</macrodef>
<macrodef name="mvn-put" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<attribute name="artifact"/>
<attribute name="groupId" />
<attribute name="artifactId"/>
<attribute name="version"/>
<attribute name="packaging" default="jar" />
<attribute name="buildtype" default="${mvn.type}" />
<attribute name="repoId" default="${mvn.repo.id}" />
<sequential>
<property name="mvn.type" value="release"/>
<antcontrib:if>
<isset property="wagon-ssh.installed" />
<then/>
<else>
<artifact:install-provider artifactId="wagon-ssh" version="1.0-beta-2"/>
<property name="wagon-ssh.installed" value="true"/>
</else>
</antcontrib:if>
<pom-and-deploy pomid="cfdistro.put.pom" artifact="@{artifact}" packaging="@{packaging}" buildtype="@{buildtype}"
groupId="@{groupId}" artifactId="@{artifactId}" version="@{version}" repoId="@{repoId}"/>
</sequential>
</macrodef>
<macrodef name="delete-snapshots">
<attribute name="repo" />
<attribute name="artifact" default="" />
<attribute name="groupId" default="" />
<attribute name="artifactId" default="" />
<attribute name="version" default="" />
<sequential>
<antcontrib:propertyregex
property="dependency.location"
input="@{groupId}"
global="true" override="yes"
regexp="\."
replace="/" />
<delete>
<fileset dir="@{repo}/${dependency.location}/@{artifactId}/@{version}">
<containsregexp expression="[0-9]{8}.[0-9]{6}-[0-9]+"/>
</fileset>
</delete>
</sequential>
</macrodef>
<macrodef name="pom-and-deploy">
<attribute name="pomid" />
<attribute name="buildtype" default="release" />
<attribute name="artifact" default="" />
<attribute name="file" default="" />
<attribute name="groupId" default="" />
<attribute name="artifactId" default="" />
<attribute name="version" default="" />
<attribute name="name" default="" />
<attribute name="packaging" default="jar" />
<attribute name="repoId" default="${mvn.repo.id}" />
<attribute name="deletesnapshots" default="true" />
<element name="dependencies" optional="true" />
<element name="attachments" optional="true" />
<!-- <attach file="${basedir}/target/my-project-1.0-sources.jar" type="jar" classifier="sources"/> -->
<sequential>
<!-- <artifact:install-provider artifactId="wagon-ssh" version="1.0-beta-2"/> -->
<echoproperties prefix="repository." />
<antcontrib:if>
<equals arg1="@{repoId}" arg2="$${mvn.repo.id}" />
<then>
<antcontrib:var name="__repo.id" value="cfdistro.repo.local"/>
</then>
<else>
<antcontrib:var name="__repo.id" value="@{repoId}"/>
</else>
</antcontrib:if>
<antcontrib:if>
<equals arg1="@{buildtype}" arg2="snapshot" />
<then>
<property name="__buildtype.suffix" value="-SNAPSHOT" />
</then>
</antcontrib:if>
<property name="__buildtype.suffix" value="" />
<antcontrib:if>
<and>
<equals arg1="@{buildtype}" arg2="snapshot" />
<equals arg1="@{deletesnapshots}" arg2="true" />
</and>
<then>
<dependency-location property="_snapshot.loc" groupId="@{groupId}" artifactId="@{artifactId}" version="@{version}${__buildtype.suffix}" type="@{type}" classifier="@{classifier}"/>
<echo message="Deleting any previous snapshots" />
<delete dir="${_snapshot.loc}" />
</then>
</antcontrib:if>
<antcontrib:if>
<equals arg1="@{file}" arg2="" />
<then>
<artifact:pom id="@{pomid}_tmp" groupId="@{groupId}" artifactId="@{artifactId}" version="@{version}${__buildtype.suffix}" name="@{name}" packaging="@{packaging}">
<dependencies />
</artifact:pom>
<bug170workaround pomid="@{pomid}" />
</then>
<else>
<artifact:pom id="@{pomid}" file="@{file}">
<dependencies />
</artifact:pom>
</else>
</antcontrib:if>
<antcontrib:if>
<equals arg1="@{artifact}" arg2="" />
<then>
<delete file="${temp.dir}/tmppom.pom" />
<artifact:writepom pomrefid="@{pomid}" file="${temp.dir}/tmppom.pom" trim="true"/>
<artifact:deploy file="${temp.dir}/tmppom.pom">
<remoteRepository refid="${__repo.id}" />
<!-- <localRepository path="${cfdistro.repo.local.path}" /> -->
<attachments />
<pom refid="@{pomid}"/>
</artifact:deploy>
</then>
<else>
<!--
<artifact:mvn>
<localRepository path="/tmp/farter" />
<arg value="org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file" />
<arg value="-Durl=${maven-snapshots-repository-url}" />
<arg value="-DrepositoryId=${mvn.repo.id}" />
<arg value="-DpomFile=@{pomid}" />
<arg value="-Dfile=@{artifact}" />
</artifact:mvn>
-->
<artifact:deploy file="@{artifact}">
<remoteRepository refid="${__repo.id}" />
<!-- <localRepository path="${cfdistro.repo.local.path}" /> -->
<attachments />
<pom refid="@{pomid}"/>
</artifact:deploy>
</else>
</antcontrib:if>
</sequential>
</macrodef>
<macrodef name="bug170workaround">
<attribute name="pomid" />
<attribute name="dir" default="${temp.dir}" />
<sequential>
<artifact:writepom pomrefid="@{pomid}_tmp" file="@{dir}/tmppom.xml" trim="true"/>
<artifact:pom id="@{pomid}" file="@{dir}/tmppom.xml" />
</sequential>
</macrodef>
<macrodef name="pom-info">
<attribute name="pomfile" />
<attribute name="pomid" />
<sequential>
<artifact:pom id="@{pomid}" file="@{pomfile}" />
</sequential>
</macrodef>
<property name="cfmlprojects.repo.user" value="admin" />
<property name="cfmlprojects.repo.key" value="${user.home}/.ssh/cfmlprojectskey" />
<property name="cfmlprojects.repo.key.pass" value="seekrit" />
<property name="cfmlprojects.repo.url" value="scp://cfmlprojects.org/artifacts" />
<mvn-repo id="cfmlprojects.repo" url="${cfmlprojects.repo.url}">
<authentication>
<authentication username="${cfmlprojects.repo.user}" privateKey="${cfmlprojects.repo.key}" passphrase="${cfmlprojects.repo.key.pass}"/>
</authentication>
</mvn-repo>
<target name="artifact.add">
<sequential>
<property name="mvn.repo.id" value="cfdistro.repo.local"/>
<property name="mvn.repo.id" value="cfmlprojects.repo"/>
<artifact:install-provider artifactId="wagon-ssh" version="1.0-beta-2"/>
<input message="artifact:" addproperty="artifact" />
<input message="group:" addproperty="group" />
<input message="artifactId:" addproperty="artifactId" />
<input message="name:" addproperty="name" />
<input message="version:" addproperty="version" />
<input message="classifier:" addproperty="classifier" />
<antcontrib:propertyregex property="suffix.name"
input="${artifact}" regexp="(.*)\.(.*)" select="\2" override="true"/>
<pom-and-deploy pomid="addartifact" packaging="${suffix.name}" artifact="${artifact}"
groupId="${group}" artifactId="${artifactId}" version="${version}" name="${name}" classifier="${classifier}" />
</sequential>
</target>
<!-- JRE STUFF -->
<target name="mvn.deploy.jre" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<property name="mvn.jre.dir" value="${basedir}/../jre" />
<pom-and-deploy pomid="jre.pom" packaging="pom" buildtype="release"
groupId="oracle" artifactId="${jre.type}" version="${jre.version}" name="oracle.${jre.type}">
<attachments>
<attach file="${mvn.jre.tmp}/${jre.type}${jre.version}-linux-i586.zip" type="zip" classifier="linux32"/>
<attach file="${mvn.jre.tmp}/${jre.type}${jre.version}-linux-x64.zip" type="zip" classifier="linux64"/>
<attach file="${mvn.jre.tmp}/${jre.type}${jre.version}-macosx-x64.zip" type="zip" classifier="darwin64"/>
<attach file="${mvn.jre.tmp}/${jre.type}${jre.version}-windows-i586.zip" type="zip" classifier="win32"/>
<attach file="${mvn.jre.tmp}/${jre.type}${jre.version}-windows-x64.zip" type="zip" classifier="win64"/>
</attachments>
</pom-and-deploy>
<delete dir="${mvn.jre.tmp}" />
</target>
<target name="pack2zip.jre" xmlns:artifact="antlib:org.apache.maven.artifact.ant" description="convert packed bins to zip">
<!-- only used to fill repo initially - put exploded JREs in arch subdirs -->
<property name="mvn.jre.tmp" location="${temp.dir}/jre" />
<antcontrib:var name="mvn.jre.version" value="1.6.0_41" />
<!--
<antcontrib:var name="mvn.jre.version" value="1.7.0_15" />
-->
<property name="mvn.jre.dir" location="${basedir}/../jre" />
<delete dir="${temp.dir}" />
<mkdir dir="${temp.dir}" />
<echo message="*** UNPACKING AND REPACKING LINUX PACKS ***" />
<antcontrib:for param="file">
<path><fileset dir="${mvn.jre.dir}" includes="*.bin.sh" /></path>
<sequential>
<antcontrib:var name="basename" unset="true" />
<antcontrib:var name="__locdirr" unset="true" />
<basename file="@{file}" property="basename" suffix=".bin.sh" />
<antcontrib:propertyregex global="true" override="yes"
property="basename" input="${basename}" regexp="\." replace="-"/>
<echo message="${basename}"/>
<property name="__locdirr" location="${temp.dir}/jre/${basename}" />
<mkdir dir="${__locdirr}" />
<exec executable="unzip">
<arg value="-qq"/>
<arg value="@{file}"/>
<arg value="-d"/>
<arg value="${__locdirr}"/>
</exec>
<antcontrib:for param="pack">
<path><fileset dir="${__locdirr}" includes="**/*.pack" /></path>
<sequential>
<antcontrib:propertyregex property="jar" global="true" override="yes"
input="@{pack}" regexp="pack" replace="jar"/>
<exec executable="${java.home}/bin/unpack200">
<arg value="@{pack}"/>
<arg value="${jar}"/>
</exec>
<delete file="@{pack}"/>
</sequential>
</antcontrib:for>
<delete file="${mvn.jre.dir}/${basename}.zip" />
<exec executable="/bin/sh">
<arg line='-c "cd ${__locdirr}/jre${mvn.jre.version}; zip -9 -qq -r ${mvn.jre.dir}/${basename}.zip *"'/>
</exec>
</sequential>
</antcontrib:for>
<echo message="*** UNPACKING AND REPACKING WINDOWS PACKS ***" />
<antcontrib:for param="file">
<path><fileset dir="${mvn.jre.dir}" includes="*.exe" /></path>
<sequential>
<antcontrib:var name="basename" unset="true" />
<basename file="@{file}" property="basename" suffix=".exe" />
<antcontrib:propertyregex property="basename" global="true" override="yes"
input="${basename}" regexp="\." replace="-"/>
<echo message="${basename}"/>
<exec executable="7z">
<arg value="x"/><arg value="-y"/>
<arg value="-o${temp.dir}/jre/${basename}"/>
<arg value="@{file}"/><arg value="core.zip"/>
</exec>
<unzip src="${temp.dir}/jre/${basename}/core.zip" dest="${temp.dir}/jre/${basename}/core" />
<antcontrib:for param="pack">
<path><fileset dir="${temp.dir}/jre/${basename}/core/lib" includes="**/*.pack" /></path>
<sequential>
<antcontrib:propertyregex property="jar" global="true" override="yes"
input="@{pack}" regexp="pack" replace="jar"/>
<exec executable="${java.home}/bin/unpack200">
<arg value="@{pack}"/>
<arg value="${jar}"/>
</exec>
<delete file="@{pack}"/>
</sequential>
</antcontrib:for>
<delete file="${mvn.jre.dir}/${basename}.zip" />
<zip destfile="${mvn.jre.dir}/${basename}.zip" level="9" update="false">
<fileset dir="${temp.dir}/jre/${basename}/core/" />
</zip>
</sequential>
</antcontrib:for>
<delete dir="${temp.dir}" />
</target>
<target name="jre.8.update" xmlns:artifact="antlib:org.apache.maven.artifact.ant" description="update Java 8 JREs">
<property name="jre.suffix" value="8u31" />
<property name="mvn.jre.oslist" value="macosx-x64:b13,linux-i586:b13,linux-x64:b13,windows-i586:b13,windows-x64:b13" />
<antcontrib:runtarget target="jre.7.update" />
</target>
<target name="jre.7.update" xmlns:artifact="antlib:org.apache.maven.artifact.ant" description="update Java 7 JREs">
<property name="jre.type" value="jre" />
<property name="mvn.jre.tmp" location="${temp.dir}/${jre.type}" />
<property name="jre.suffix" value="7u75" />
<property name="mvn.jre.oslist" value="macosx-x64:b13,linux-i586:b13,linux-x64:b13,windows-i586:b13,windows-x64:b13" />
<property name="mvn.jre.dir" location="${basedir}/../${jre.type}" />
<property name="jre.prefix" value="${jre.type}-${jre.suffix}" />
<property name="jre.baseurl" value="http://download.oracle.com/otn-pub/java/jdk/${jre.suffix}" />
<echoproperties prefix="jre." />
<antcontrib:propertyregex property="jre.version" global="true" override="yes"
input="${jre.prefix}" regexp="${jre.type}-(\d)u(\d+)" replace="1.\1.0_\2"/>
<input message="Do you agree to the ${jre.version} license?" addproperty="jre.lic.agree" />
<delete dir="${mvn.jre.tmp}" />
<mkdir dir="${mvn.jre.tmp}" />
<echo message="*** GETTING ${jre.type} ${jre.version} ***" />
<antcontrib:for list="${mvn.jre.oslist}" param="file">
<sequential>
<antcontrib:propertyregex property="jre.os" override="yes"
input="@{file}" regexp="([^:]*)" select="\1"/>
<antcontrib:propertyregex property="jre.b.version" override="yes"
input="@{file}" regexp=".*:(.*)" select="\1"/>
<echo message="*** GETTING ${jre.type} : ${jre.version} ${jre.prefix}-${jre.os} ${jre.b.version}***" />
<exec executable="wget" failonerror="true">
<arg value="--no-check-certificate"/>
<arg line='--header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F"'/>
<arg line='--header "Cookie: gpv_p24=no%20value"'/>
<arg line='--header "Cookie: oraclelicense=accept-securebackup-cookie"'/>
<arg value="-O"/><!-- only if newer is N -->
<arg value="${mvn.jre.tmp}/${jre.prefix}-${jre.os}.tar.gz"/>
<arg value="${jre.baseurl}-${jre.b.version}/${jre.prefix}-${jre.os}.tar.gz"/>
</exec>
<delete dir="${mvn.jre.tmp}/${jre.os}"/>
<gunzip src="${mvn.jre.tmp}/${jre.prefix}-${jre.os}.tar.gz" dest="${mvn.jre.tmp}/${jre.prefix}-${jre.os}.tar"/>
<untar src="${mvn.jre.tmp}/${jre.prefix}-${jre.os}.tar" dest="${mvn.jre.tmp}/${jre.os}"/>
<antcontrib:var unset="true" name="jre_dir_name"/>
<antcontrib:var unset="true" name="jre-dir-name"/>
<path id="jre_dir_name">
<dirset dir="${mvn.jre.tmp}/${jre.os}">
<include name="${jre.type}*"/>
</dirset>
</path>
<property name="jre-dir-name" refid="jre_dir_name" />
<antcontrib:if>
<available file="${jre-dir-name}/Contents/Home/" />
<then><!-- OS X -->
<move todir="${jre-dir-name}">
<fileset dir="${jre-dir-name}/Contents/Home" defaultexcludes="false"/>
</move>
<move todir="${jre-dir-name}/lib">
<fileset dir="${jre-dir-name}/Contents/MacOS" defaultexcludes="false"/>
</move>
<delete dir="${jre-dir-name}/Contents" />
<chmod file="${jre-dir-name}/lib/jspawnhelper" perm="+x"/>
</then>
</antcontrib:if>
<antcontrib:if>
<available file="${jre-dir-name}/bin" />
<then>
<chmod dir="${jre-dir-name}/bin" perm="+x" includes="*"/>
</then>
</antcontrib:if>
<zipdir destfile="${mvn.jre.tmp}/${jre.type}${jre.version}-${jre.os}.zip" sourcedir="${jre-dir-name}/" />
</sequential>
</antcontrib:for>
<echo message="*** POMN ***" />
<pom-and-deploy pomid="jre.pom" packaging="pom" buildtype="release"
groupId="oracle" artifactId="${jre.type}" version="${jre.version}" name="oracle.${jre.type}">
<attachments>
<attach file="${mvn.jre.tmp}/${jre.type}${jre.version}-linux-i586.zip" type="zip" classifier="linux32"/>
<attach file="${mvn.jre.tmp}/${jre.type}${jre.version}-linux-x64.zip" type="zip" classifier="linux64"/>
<attach file="${mvn.jre.tmp}/${jre.type}${jre.version}-macosx-x64.zip" type="zip" classifier="darwin64"/>
<attach file="${mvn.jre.tmp}/${jre.type}${jre.version}-windows-i586.zip" type="zip" classifier="win32"/>
<attach file="${mvn.jre.tmp}/${jre.type}${jre.version}-windows-x64.zip" type="zip" classifier="win64"/>
</attachments>
</pom-and-deploy>
<delete dir="${temp.dir}" />
</target>
<!--
NEXUS STUFF
-->
<property name="nexus.version" value="2.0.6" />
<property name="ext.nexus.dir" location="${ext.dir}/nexus/${nexus.version}" />
<property name="nexus.dir" location="${user.home}/nexus" />
<property name="nexus.repo.dir" location="${user.home}/nexus/repo" />
<property name="ext.nexus.war.uri" value="http://www.sonatype.org/downloads/nexus-${nexus.version}.war" />
<property name="ext.nexus.war" location="${ext.nexus.dir}/nexus-${nexus.version}.war" />
<property name="nexus.war" location="${nexus.dir}/nexus-${nexus.version}.war" />
<property name="nexus.context" value="/nexus" />
<available file="${nexus.war}" property="nexus.isconfigured" />
<!-- This will download the "latest version" of the maven-ant-tasks if needed
<target name="bootstrap_maven" unless="maven.ant.tasks.jar.exists">
<property name="maven.ant.tasks.bootstrap.location" value="https://builds.apache.org/job/maven-ant-tasks/org.apache.maven$maven-ant-tasks/lastSuccessfulBuild/artifact/org.apache.maven/maven-ant-tasks/2.1.4-SNAPSHOT/maven-ant-tasks-2.1.4-SNAPSHOT.jar" />
<get src="${maven.ant.tasks.bootstrap.location}" dest="${maven.ant.tasks.jar}" skipexisting="true" />
</target>
-->
<property name="nexus.admin.user" value="${ci.admin.user}" />
<property name="nexus.admin.password" value="${ci.admin.password}" />
<property name="nexus.port" value="8081" />
<property name="nexus.host" value="127.0.0.1" />
<property name="nexus.baseurl" value="http://${nexus.host}:${nexus.port}/nexus" />
<property name="nexus.background" value="true" />
<target name="nexus.install">
<mkdir dir="${ext.nexus.dir}"/>
<mkdir dir="${nexus.dir}"/>
<sequential>
<required-resource
src="${ext.nexus.war.uri}"
dest="${ext.nexus.war}"/>
<unzip src="${ext.nexus.war}" dest="${nexus.war}" />
</sequential>
</target>
<target name="nexus.configure" unless="nexus.isconfigured">
<mkdir dir="${nexus.dir}"/>
<sequential>
<!-- <cfdistro target="cfdistro.dist" properties="dist.dir=${nexus.dir}/workspace/cfdistrojob/" /> -->
<required-resource
src="${ext.nexus.war.uri}"
dest="${ext.nexus.war}"
/>
<antcontrib:runtarget target="nexus.install" />
<sha plaintext="${nexus.admin.password}" property="nexus.admin.password.hash" />
<echo message="Admin: ${nexus.admin.user} ${nexus.admin.password} (${nexus.admin.password.hash})" />
<property name="nexus.nonpub.password" value="nonpubpass" />
<sha plaintext="${nexus.nonpub.password}" property="nexus.nonpub.password.hash" />
<propertyfile file="${nexus.war}/WEB-INF/plexus.properties">
<entry key="nexus-work" value="${nexus.dir}/sonatype-work"/>
<entry key="security-xml-file" value="${nexus.dir}/security.xml"/>
</propertyfile>
<echo file="${nexus.dir}/security.xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?><security><version>2.0.5</version>
<users>
<user>
<id>${nexus.admin.user}</id>
<firstName>Administrator</firstName>
<password>${nexus.admin.password.hash}</password>
<status>active</status>
<email>[email protected]</email>
</user>
<user>
<id>nonpub</id>
<firstName>nonpub</firstName>
<password>${nexus.nonpub.password.hash}</password>
<status>active</status>
<email>[email protected]</email>
</user>
<user>
<id>anonymous</id>
<firstName>Nexus</firstName>
<lastName>Anonymous User</lastName>
<password>0a92fab3230134cca6eadd9898325b9b2ae67998</password>
<status>active</status>
<email>[email protected]</email>
</user>
</users>
<userRoleMappings>
<userRoleMapping>
<userId>ci</userId>
<source>default</source>
<roles>
<role>nx-admin</role>
</roles>
</userRoleMapping>
<userRoleMapping>
<userId>anonymous</userId>
<source>default</source>
<roles>
<role>anonymous</role>
</roles>
</userRoleMapping>
</userRoleMappings>
</security>
]]></echo>
<unzip src="${nexus.war}/WEB-INF/lib/nexus-oss-edition-2.0.6.jar" dest="${nexus.dir}/sonatype-work/conf/">
<patternset>
<include name="META-INF/nexus/nexus.xml"/>
</patternset>
<mapper type="flatten"/>
</unzip>
<xmltask source="${nexus.dir}/sonatype-work/conf/nexus.xml" dest="${nexus.dir}/sonatype-work/conf/nexus.xml">
<cut path="nexusConfiguration/repositories/repository[id[text()='releases']]" buffer="releaseReop" />
<cut path="nexusConfiguration/repositories/repository[id[text()='snapshots']]" buffer="snapshotReop"/>
<remove path="nexusConfiguration/repositories/*"/>
<paste path="nexusConfiguration/repositories" buffer="releaseReop"/>
<paste path="nexusConfiguration/repositories" buffer="snapshotReop"/>
<remove path="nexusConfiguration/repositories/repository[id[text()='releases']]/localStorage/*"/>
<insert path="nexusConfiguration/repositories/repository[id[text()='releases']]"
xml="<localStorage><provider>file</provider><url>${nexus.repo.dir}</url></localStorage>" />
<insert path="nexusConfiguration/restApi"><![CDATA[<baseUrl>${nexus.baseurl}</baseUrl>
<forceBaseUrl>true</forceBaseUrl>]]>
</insert>
</xmltask>
</sequential>
</target>
<target name="nexus.start" depends="nexus.configure">
<java jar="${cfdistro.lib.dir}/runwar.jar" fork="true" spawn="false" maxmemory="${runwar.maxmemory}" failonerror="true">
<jvmarg line="${server.jvm.args}"/>
<arg value="-war" /><arg value="${nexus.war}/" />
<arg value="-context" /><arg value="${nexus.context}" />
<arg value="-host" /><arg value="${nexus.host}" />
<arg value="-port" /><arg value="${nexus.port}" />
<arg value="-stop-port" /><arg value="8992" />
<arg value="-enable-ajp" /><arg value="false" />
<arg value="-ajp-port" /><arg value="${server.port.ajp}" />
<arg value="-log-dir" /><arg value="${nexus.dir}" />
<arg value="-loglevel" /><arg value="INFO" />
<arg value="-dirs" /><arg value="${nexus.dir}" />
<arg value="-background" /><arg value="${nexus.background}" />
<arg value="-requestlog" /><arg value="false" />
<arg value="-open-browser" /><arg value="false" />
<arg value="-open-url" /><arg value="none" />
<arg value="-osxprocessname" /><arg value="nexus" />
</java>
</target>
<target name="nexus.stop" depends="nexus.configure">
<java jar="${cfdistro.lib.dir}/runwar.jar" fork="true" spawn="false" maxmemory="${runwar.maxmemory}" failonerror="true">
<jvmarg line="${server.jvm.args}"/>
<arg value="-stop" /><arg value="8992" />
</java>
</target>
</project>