forked from openmrs/openmrs-core
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
98 lines (83 loc) · 4.39 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
<?xml version="1.0"?>
<!--
This Source Code Form is subject to the terms of the Mozilla Public License,
v. 2.0. If a copy of the MPL was not distributed with this file, You can
obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
graphic logo is a trademark of OpenMRS Inc.
-->
<!-- *********************************************************** -->
<!-- ** Ant build script for OpenMRS ** -->
<!-- ** ** -->
<!-- ** This file is provided for those that cannot use ** -->
<!-- ** maven. Using "mvn" instead of "ant" is recommended ** -->
<!-- ** ** -->
<!-- *********************************************************** -->
<project name="OpenMRS-trunk" default="dist" xmlns:artifact="urn:maven-artifact-ant">
<property environment="env"/>
<property name="root.dir" value="."/>
<property name="lib.dir" value="${root.dir}${file.separator}lib"/>
<property name="maven.ant.tasks.jar" value="${lib.dir}${file.separator}maven-ant-tasks-2.1.1.jar"/>
<property name="maven.ant.tasks.bootstrap.location" value="http://repo2.maven.org/maven2/org/apache/maven/maven-ant-tasks/2.1.1/maven-ant-tasks-2.1.1.jar"/>
<property name="maven.ant.contrib.jar" value="${lib.dir}${file.separator}ant-contrib-1.0b3.jar"/>
<property name="maven.ant.contrib.bootstrap.location" value="http://repo1.maven.org/maven2/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar"/>
<available property="m2.home.exists" file="${env.M2_HOME}" type="dir"/>
<!-- This will download ant-contrib and maven-ant-tasks if needed. Requires Ant 1.8.0 for skipexisting -->
<mkdir dir="${lib.dir}"/>
<get src="${maven.ant.contrib.bootstrap.location}" dest="${maven.ant.contrib.jar}" skipexisting="true"/>
<get src="${maven.ant.tasks.bootstrap.location}" dest="${maven.ant.tasks.jar}" skipexisting="true"/>
<property file="build.properties"/>
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${maven.ant.contrib.jar}"/>
</classpath>
</taskdef>
<!-- This will initialize all the maven ant tasks -->
<target name="init-maven-tasks">
<path id="maven.ant.tasks.classpath" path="${maven.ant.tasks.jar}" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpathref="maven.ant.tasks.classpath" />
</target>
<!-- Use existing maven install or built in maven? -->
<target name="use-existing-maven-install" depends="init-maven-tasks" if="m2.home.exists">
<macrodef name="maven">
<attribute name="pom" default="pom.xml"/>
<attribute name="dir" default="."/>
<attribute name="options" default=""/>
<sequential>
<artifact:mvn mavenHome="${env.M2_HOME}" pom="@{pom}" fork="true" dir="@{dir}">
<arg line="@{options}"/>
</artifact:mvn>
</sequential>
</macrodef>
</target>
<target name="use-built-in-maven" depends="init-maven-tasks" unless="m2.home.exists">
<macrodef name="maven">
<attribute name="pom" default="pom.xml"/>
<attribute name="dir" default="."/>
<attribute name="options" default=""/>
<sequential>
<artifact:mvn pom="@{pom}" fork="true" dir="@{dir}">
<arg line="@{options}"/>
</artifact:mvn>
</sequential>
</macrodef>
</target>
<target name="init-maven-macro" depends="use-existing-maven-install,use-built-in-maven"/>
<!-- Tasks forwarded to maven goals -->
<target name="clean" depends="init-maven-macro">
<maven options="clean"/>
</target>
<target name="package-all" depends="init-maven-macro" description="packages api, test, and web jars for use in modules">
<maven options="install -DskipTests"/>
</target>
<target name="junit" depends="init-maven-macro" description="Run all junit tests">
<maven options="org.apache.maven.plugins:maven-surefire-plugin:2.4.2:test"/>
</target>
<target name="jetty-run" depends="package-all" description="Start a Jetty webserver with openmrs installed">
<maven options="jetty:run" pom="webapp/pom.xml" dir="webapp"/>
</target>
<!-- Pure ant tasks -->
<target name="dist" depends="package-all" description="create distributable war file" />
<target name="war" depends="dist" description="create distributable war file" />
</project>