-
Notifications
You must be signed in to change notification settings - Fork 15
/
utils.xml
111 lines (100 loc) · 5.89 KB
/
utils.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
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<!-- xml namespace which is used to deploy the artifacts with maven -->
<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="antlib:org.apache.maven.artifact.ant"
classpath="lib/maven-ant-tasks-2.1.3.jar"/>
<taskdef resource="net/sf/antcontrib/antcontrib.properties"
classpath="lib/ant-contrib-0.6.jar"/>
<!-- defined maven snapshots and staging repository id and url -->
<property name="maven-staging-repository-id" value="apache.releases.https" />
<property name="maven-staging-repository-url"
value="https://repository.apache.org/service/local/staging/deploy/maven2" />
<property name="maven-pgp-passphrase" value=""/>
<property name="maven-pgp-keyname" value=""/>
<macrodef name="apache-deploy">
<attribute name="binaryFile"/>
<attribute name="sourcesFile" default=""/>
<attribute name="docFile" default=""/>
<attribute name="todir"/>
<attribute name="pomTemplate"/>
<attribute name="artifact"/>
<attribute name="type"/>
<attribute name="name"/>
<attribute name="version"/>
<attribute name="description"/>
<sequential>
<!-- Create POM from template -->
<copy file="@{pomTemplate}" tofile="@{todir}/@{artifact}-@{version}.pom"/>
<replace file="@{todir}/@{artifact}-@{version}.pom">
<replacefilter token="@ARTIFACT@" value="@{artifact}"/>
<replacefilter token="@TYPE@" value="@{type}"/>
<replacefilter token="@NAME@" value="@{name}"/>
<replacefilter token="@VERSION@" value="@{version}"/>
<replacefilter token="@DESCRIPTION@" value="@{description}"/>
</replace>
<copy file="@{binaryFile}" tofile="@{todir}/@{artifact}-@{version}.@{type}" />
<if>
<equals arg1="@{type}" arg2="jar" />
<then>
<copy file="@{sourcesFile}" tofile="@{todir}/@{artifact}-@{version}-sources.@{type}" />
<copy file="@{docFile}" tofile="@{todir}/@{artifact}-@{version}-javadoc.@{type}" />
</then>
</if>
<!-- sign and deploy the main artifact -->
<artifact:mvn>
<artifact:arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file"/>
<artifact:arg value="-Durl=${maven-staging-repository-url}"/>
<artifact:arg value="-DrepositoryId=${maven-staging-repository-id}"/>
<artifact:arg value="-DpomFile=@{todir}/@{artifact}-@{version}.pom"/>
<artifact:arg value="-Dfile=@{todir}/@{artifact}-@{version}.@{type}"/>
<artifact:arg value="-Dgpg.passphrase=${maven-pgp-passphrase}"/>
<artifact:arg value="-Dgpg.keyname=${maven-pgp-keyname}"/>
<artifact:arg value="-Pgpg"/>
</artifact:mvn>
<if>
<equals arg1="@{type}" arg2="jar" />
<then>
<!-- sign and deploy the sources artifact -->
<artifact:mvn>
<artifact:arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file"/>
<artifact:arg value="-Durl=${maven-staging-repository-url}"/>
<artifact:arg value="-DrepositoryId=${maven-staging-repository-id}"/>
<artifact:arg value="-DpomFile=@{todir}/@{artifact}-@{version}.pom"/>
<artifact:arg value="-Dfile=@{todir}/@{artifact}-@{version}-sources.@{type}"/>
<artifact:arg value="-Dclassifier=sources"/>
<artifact:arg value="-Dgpg.passphrase=${maven-pgp-passphrase}"/>
<artifact:arg value="-Dgpg.keyname=${maven-pgp-keyname}"/>
<artifact:arg value="-Pgpg"/>
</artifact:mvn>
<!-- sign and deploy the javadoc artifact -->
<artifact:mvn>
<artifact:arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file"/>
<artifact:arg value="-Durl=${maven-staging-repository-url}"/>
<artifact:arg value="-DrepositoryId=${maven-staging-repository-id}"/>
<artifact:arg value="-DpomFile=@{todir}/@{artifact}-@{version}.pom"/>
<artifact:arg value="-Dfile=@{todir}/@{artifact}-@{version}-javadoc.@{type}"/>
<artifact:arg value="-Dclassifier=javadoc"/>
<artifact:arg value="-Dgpg.passphrase=${maven-pgp-passphrase}"/>
<artifact:arg value="-Dgpg.keyname=${maven-pgp-keyname}"/>
<artifact:arg value="-Pgpg"/>
</artifact:mvn>
</then>
</if>
</sequential>
</macrodef>
</project>