-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
160 lines (139 loc) · 6.32 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
<!--
vi:ts=3:sw=3:expandtab:
-->
<project name="jboss-ejb3-ivy"
xmlns:ivy="antlib:org.apache.ivy.ant"
xmlns:maven="urn:maven-artifact-ant"
default="package">
<!-- Bootstrap Ivy -->
<property name="ivy.version" value="2.0.0"/>
<property name="ivy.dir" value="${user.home}/.ivy2/cache/org.apache.ivy/jars"/>
<property name="ivy.jar.name" value="ivy-${ivy.version}.jar"/>
<mkdir dir="${ivy.dir}"/>
<!-- skipexisting needs ant 1.8 -->
<get usetimestamp="true" src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/${ivy.jar.name}" dest="${ivy.dir}/${ivy.jar.name}"/>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpath="${ivy.dir}/${ivy.jar.name};target/classes"/>
<!-- Setup Ivy -->
<!--
<path id="ivy.lib.path">
<fileset dir="/opt/apache-ivy" includes="*.jar"/>
<pathelement path="target/classes"/>
</path>
-->
<!-- Because we're hacking our own task, we must share class loaders -->
<!--
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path" loaderref="ivy.lib.path.loader"/>
-->
<!-- Load settings -->
<ivy:settings file="src/main/ivy/ivysettings.xml"/>
<import file="src/main/ant/maven-ant-tasks.xml"/>
<import file="src/main/ant/xpath-task.xml"/>
<!-- The current version -->
<property name="module.version.target" value="1.0"/>
<target name="clean-build" description="clean the project build files">
<delete includeemptydirs="true" dir="target"/>
</target>
<target name="compile" depends="resolve">
<ivy:cachepath pathid="compile.classpath" conf="compile"/>
<mkdir dir="target/classes"/>
<javac debug="true" srcdir="src/main/java" destdir="target/classes" classpathref="compile.classpath"/>
</target>
<!-- normally don't depend on xpath, it should be defined already -->
<target name="deploy" depends="package,makepom,define-xpath"
description="deploy the artifacts to the snapshot repository">
<xpath file="${user.home}/.m2/settings.xml" expression="/settings/servers/server[id='snapshots.jboss.org']/username" property="dav.username"/>
<xpath file="${user.home}/.m2/settings.xml" expression="/settings/servers/server[id='snapshots.jboss.org']/password" property="dav.password"/>
<maven:deploy file="target/jboss-ejb3-ivy.jar">
<pom file="target/pom.xml"/>
<!-- TODO: refid="snapshots.jboss.org" -->
<remoteRepository url="dav:https://snapshots.jboss.org/maven2">
<authentication username="${dav.username}" password="${dav.password}"/>
</remoteRepository>
</maven:deploy>
</target>
<!-- Normally depends on resolve, but we're doing ourselves -->
<target name="generatepom" depends="resolve">
<!--
<taskdef name="generatepom" classname="org.jboss.ejb3.ivy.ant.GeneratePom" classpathref="ivy.lib.path" loaderref="ivy.lib.path.loader"/>
<generatepom pomFile="target/pom.xml"/>
-->
<ivy:deliver/>
</target>
<target name="ivy-new-version" unless="ivy.new.revision">
<property name="module.version.prefix" value="${module.version.target}-dev-"/>
<ivy:info/>
<ivy:buildnumber organisation="${ivy.organisation}" module="${ivy.module}" revision="${module.version.prefix}" defaultBuildNumber="1" revSep=""/>
</target>
<target name="local-version">
<tstamp>
<format property="now" pattern="yyyyMMddHHmmss" timezone="UTC"/>
</tstamp>
<property name="ivy.new.revision" value="${module.version.target}-${now}-local"/>
</target>
<target name="makepom" depends="resolve,local-version">
<!-- note that we use module.version.target and not version -->
<ivy:deliver
deliverpattern="${ivy.distrib.dir}/[type]s/[artifact].[ext]"
pubdate="${now}"
pubrevision="${module.version.target}-SNAPSHOT"
status="integration"/>
<ivy:makepom
ivyfile="${ivy.distrib.dir}/ivys/ivy.xml"
pomfile="target/pom.xml">
<mapping conf="compile" scope="compile"/>
<mapping conf="test" scope="test"/>
</ivy:makepom>
</target>
<target name="package" depends="version,compile"
description="package the output directory into a jar file">
<jar destfile="target/jboss-ejb3-ivy.jar">
<fileset dir="target/classes"/>
</jar>
</target>
<target name="publish" depends="clean-build,package"
description="publish this project in the shared ivy repository">
<ivy:publish resolver="shared" pubrevision="${version}" status="milestone">
<artifacts pattern="target/[artifact].[ext]"/>
</ivy:publish>
</target>
<target name="publish-local" depends="local-version,package"
description="publish this project in the local ivy repository">
<ivy:publish resolver="local" pubrevision="${version}" pubdate="${now}"
status="integration" forcedeliver="true">
<artifacts pattern="target/[artifact].[ext]"/>
</ivy:publish>
</target>
<target name="resolve">
<ivy:resolve/>
</target>
<target name="test" depends="test-compile"
description="execute all tests">
<mkdir dir="target/reports"/>
<junit printsummary="true">
<classpath>
<pathelement path="target/classes"/>
<pathelement path="target/test-classes"/>
<path refid="test.classpath"/>
</classpath>
<formatter type="plain"/>
<formatter type="xml"/>
<batchtest todir="target/reports">
<fileset dir="src/test/java" includes="**/*Test*.java"/>
</batchtest>
</junit>
</target>
<target name="test-compile" depends="compile">
<ivy:cachepath pathid="ivy.test.classpath" conf="test"/>
<path id="test.classpath">
<pathelement location="target/classes"/>
<path refid="ivy.test.classpath"/>
</path>
<mkdir dir="target/test-classes"/>
<javac debug="true" srcdir="src/test/java" destdir="target/test-classes" classpathref="test.classpath"/>
</target>
<target name="version" depends="ivy-new-version">
<mkdir dir="target/ivy"/>
<echo message="version=${ivy.new.revision}" file="target/ivy/${ant.project.name}.properties" append="false"/>
<property file="target/ivy/${ant.project.name}.properties"/>
</target>
</project>