summaryrefslogtreecommitdiff
path: root/orkweb/deploy-template.xml
blob: f536b38e933006caebc11873565f78eb56b7a40d (plain)
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
<?xml version="1.0"?>
<project name="ServletDeploy" default="do_everything">
   <!--
      This ANT script does NOT compile the application,
      we are relying on Eclipse to do all Java compilation.
      This script merely deploys the application to Tomcat.

      You will need Tomcat manager running and working
      login for Tomcat manager. To create a user for
      Tomcat manager, edit the file
      
         <tomcat>\conf\tomcat-users.xml
         
      and add a line for the desired user, such as
      
        <user 
           username="username" 
           password="password" 
           fullName="Your Fullname" 
           roles="manager"/>

      If it is not already there, you may want a to add 
      the manager role above the user line... such as
      
         <role rolename="manager"/>
      	
     Using the manager to install/remove applications keeps
     you from having to stop and restart Tomcat every time
     you need to update your application.
   -->
	
	<!-- Change these properties to suit your needs (Begin)-->
   <property name="application" value="orkweb" />
   <property name="tomcatHome" value="C:\Program Files\Apache Software Foundation\Tomcat 5.5" />
   <property name="tomcatHomeEsc" value="C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%205.5" />
   <property name="workspaceHome" value="c:/devOrk/" />
   <property name="mgrUsername" value="admin" />
   <property name="mgrPassword" value="" />
	<!-- Change these properties to suit your needs (End)-->

	
   <property name="webappsHome" value="${tomcatHome}/webapps" />
   <property name="webappsHomeEsc" value="${tomcatHomeEsc}/webapps" />	
   <property name="appHome" value="${webappsHome}/${application}" />
   <property name="contextHome" value="${workspaceHome}/${application}/context" />
   <property name="srcHome" value="${workspaceHome}/${application}/src" /> 
   <property name="deployWarDir" value="${workspaceHome}/${application}/DeployWar" />
   <property name="mgrUrl" value="http://localhost:8080/manager" />
   <property name="mgrRemoveUrl" value="${mgrUrl}/remove" />
   <property name="mgrDeployUrl" value="${mgrUrl}/install" />
   <property name="orkbasejHome" value="${workspaceHome}/orkbasej" />
	
	<target name="create_war">
	      <mkdir dir="${deployWarDir}" /> 
	      <delete file="${deployWarDir}/${application}.war" />
	      <war
	        duplicate="preserve"
	      	destfile="${deployWarDir}/${application}.war"
	      	webxml="${contextHome}/WEB-INF/web.xml">
	      	<classes dir="${contextHome}/WEB-INF/classes" />
	      	<classes dir="${orkbasejHome}/bin" />
	      	<fileset dir="${contextHome}">
	      	   <include name="*" />
	      	   <include name="images/*" />
	      	   <include name="images/common/*" />	
	      	   <include name="WEB-INF/*.page" />
	      	   <include name="WEB-INF/*.application" />
	      	   <include name="WEB-INF/*.jwc" />
	      	   <include name="WEB-INF/*.html" />
	      	   <include name="WEB-INF/*.properties" />   
	      	   <include name="WEB-INF/*.xml" />    	    	   
	      	   <include name="css/*.css" />
	      	</fileset>
	      </war>
	</target>

	<target name="remove_context">
	      <delete file="temp.txt" />
	      <get
	         src="${mgrRemoveUrl}?path=/${application}"
	         dest="temp.txt"
	         username="${mgrUsername}" 
	         password="${mgrPassword}" />
	      <loadfile property="remove.result"
	         srcFile="temp.txt" />
	      <echo>${remove.result}</echo>
	      <delete file="temp.txt" />	
		
	      <!-- Remove the directory containing the old version of the application -->
	      <delete dir="${webappsHome}/${application}" />
	</target>
	
   <target name="deploy">        
      <!-- Deploy to Tomcat -->
      <unzip 
         src="${deployWarDir}/${application}.war"
         dest="${webappsHome}/${application}" />
   </target> 

	<target name="install_context">
	      <!-- Install the application -->
	      <delete file="temp.txt" />
	      <property name="mgrDeployParams"
	         value="path=/${application}&amp;war=file://${webappsHomeEsc}/${application}/" />
	      <get
	         src="${mgrDeployUrl}?${mgrDeployParams}"
	         dest="temp.txt"
	         ignoreerrors="true"
	         verbose="true"
	         username="${mgrUsername}" 
	         password="${mgrPassword}" />
	      <loadfile property="install.result"
	         srcFile="temp.txt" />
	      <echo>${install.result}</echo>
	      <delete file="temp.txt" />	
	</target>
	
   <target name="do_everything" depends="create_war,remove_context,deploy,install_context" />

</project>