forked from uPortal-Attic/ContentManagementPortlet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
123 lines (98 loc) · 4.86 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
<!--
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 name="ContentManagementPortlet" default="package" basedir=".">
<!-- ******************* PROPERTIES ************************* -->
<property file="build.properties" />
<property environment="env" />
<condition property="maven.exec.file" value="mvn.bat" else="mvn">
<os family="windows" />
</condition>
<property name="maven.exec" value="${maven.home}\bin\${maven.exec.file}" />
<condition property="tomcat.startup.file" value="startup.bat" else="startup">
<os family="windows" />
</condition>
<property name="tomcat.startup" value="${tomcat.dir}\bin\${tomcat.startup.file}" />
<condition property="tomcat.shutdown.file" value="shutdown.bat" else="shutdown">
<os family="windows" />
</condition>
<property name="tomcat.shutdown" value="${tomcat.dir}\bin\${tomcat.shutdown.file}" />
<!-- ******************************************************** -->
<!-- ******************* PROPERTY CHECKS ************************* -->
<available type="dir" file="${portal.dir}" property="portal.directory.present" />
<fail unless="${portal.directory.present}" message="Portal directory ${portal.dir} does not exist" />
<available type="file" file="${maven.exec}" property="maven.exec.present" />
<fail unless="${maven.exec.present}" message="Maven exec ${maven.exec} does not exist" />
<available type="file" file="${tomcat.startup}" property="tomcat.startup.present" />
<fail unless="${tomcat.startup.present}" message="Tomcat startup script ${tomcat.startup} does not exist" />
<available type="file" file="${tomcat.shutdown}" property="tomcat.shutdown.present" />
<fail unless="${tomcat.shutdown.present}" message="Tomcat shutdown {tomcat.shutdown} does not exist" />
<!-- ************************************************************* -->
<!-- *************************** PROMPTS ************************* -->
<echo message="Portal directory: ${portal.dir}" level="info" />
<echo message="Tomcat directory: ${tomcat.dir}" level="info" />
<echo message="Maven directory: ${maven.home}" level="info" />
<!-- ************************************************************* -->
<target name="connectToTomcat">
<echo message="Checking to see if Tomcat is running on ${tomcat.host}:${tomcat.port}" />
<condition property="tomcat.running">
<socket server="${tomcat.host}" port="${tomcat.port}" />
</condition>
</target>
<target name="deploy" depends="stopTomcat, package, startTomcat" />
<target name="compile" depends="clean">
<echo message="Compiling application artifacts..." />
<exec dir="." executable="${maven.exec}">
<arg value="clean" />
<arg value="compile" />
<arg value="-f" />
<arg value="pom.xml" />
<arg value="-e" />
</exec>
</target>
<target name="package" depends="clean">
<echo message="Packaging application artifacts..." />
<exec dir="." executable="${maven.exec}">
<arg value="integration-test" />
<arg value="-f" />
<arg value="pom.xml" />
<arg value="-e" />
</exec>
</target>
<target name="cleanWar">
<echo message="Cleaning war file..." />
<delete file="${tomcat.dir}\webapps\${ant.project.name}.war" verbose="false" />
</target>
<target name="cleanDeploymentDirectory">
<echo message="Cleaning deployment directorty..." />
<delete dir="${tomcat.dir}\webapps\${ant.project.name}" verbose="false" includeemptydirs="true" />
</target>
<target name="clean" depends="cleanWar, cleanDeploymentDirectory">
<echo message="Cleaning application artifacts..." />
<exec dir="." executable="${maven.exec}">
<arg value="clean" />
<arg value="-f" />
<arg value="pom.xml" />
<arg value="-e" />
</exec>
</target>
<target name="startTomcat" depends="connectToTomcat" unless="${tomcat.running}">
<echo message="Starting Tomcat..." />
<exec dir="${tomcat.dir}" executable="${tomcat.startup}" />
</target>
<target name="stopTomcat" depends="connectToTomcat" if="${tomcat.running}">
<echo message="Stopping Tomcat..." />
<exec dir="${tomcat.dir}" executable="${tomcat.shutdown}" />
</target>
</project>