-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
executable file
·93 lines (79 loc) · 3.08 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="shop" basedir="." default="127.to.100">
<!--版本号-->
<property name="version" value="1.0"/>
<property name="year" value="2017"/>
<!--项目jar包目录 -->
<property name="classpath_lib" value="${basedir}/WebRoot/WEB-INF/lib"/>
<!--项目发布目录 -->
<property name="serviceName" value="webservice"/>
<property name="servicedir" value="/data/wl/war/${serviceName}/WEB-INF"/>
<!--tomcat的lib目录,用于java代码编译 -->
<property name="tomcat.lib" value="/usr/lib/jenkinsLib"/>
<!--服务器的主机,用户名,密码-->
<property name="www.weblogic.host" value="192.168.52.100"/>
<property name="www.weblogic.user" value="weblogic"/>
<property name="www.weblogic.password" value="lbjr123.com"/>
<!--清理项目的打包目录,并拷贝项目所有源代码到打包目录-->
<property name="build" value="build"/>
<property name="src" value="src"/>
<target name="init">
<delete dir="${build}"/>
<mkdir dir="${build}"/>
<mkdir dir="${build}\agreement"/>
<mkdir dir="${build}\agreement\ftl"/>
<mkdir dir="${build}\WEB-INF"/>
<mkdir dir="${build}\WEB-INF\classes"/>
<copy todir="${build}">
<fileset dir="${basedir}\WebRoot">
<include name="WEB-INF/**"/>
<include name="**"/>
</fileset>
</copy>
<copy todir="${build}\WEB-INF\classes\com">
<fileset dir="${basedir}\config\com">
<include name="**/*"/>
</fileset>
</copy>
</target>
<!--编译java代码-->
<target name="complie" depends="init">
<path id="classpath" description="">
<fileset dir="${tomcat.lib}">
<include name="**/*.jar"/>
<exclude name="**/*.bak"/>
</fileset>
<fileset dir="${classpath_lib}">
<include name="**/*.jar"/>
<exclude name="**/*.bak"/>
</fileset>
</path>
<javac debug="true" encoding="utf-8" srcdir="${src}" destdir="${build}\WEB-INF\classes" includeantruntime="on">
<classpath refid="classpath" description=""/>
</javac>
</target>
<!--将172项目打好包的文件发布到206服务器-->
<target name="127.to.100" depends="complie">
<sshexec host="${www.weblogic.host}" username="${www.weblogic.user}" password="${www.weblogic.password}" trust="true"
command="rm -rf ${servicedir}/classes/com/*;rm -rf ${servicedir}/lib/*"/>
<scp todir="${www.weblogic.user}@${www.weblogic.host}:${servicedir}/lib"
username="${www.weblogic.user}" password="${www.weblogic.password}" trust="true">
<fileset dir="${build}/WEB-INF/lib">
<include name="**/**"/>
</fileset>
</scp>
<scp todir="${www.weblogic.user}@${www.weblogic.host}:${servicedir}/classes/com"
username="${www.weblogic.user}" password="${www.weblogic.password}" trust="true">
<fileset dir="${build}/WEB-INF/classes/com">
<include name="**/**"/>
</fileset>
</scp>
<!--<antcall target="restart.server"/>-->
</target>
<!--重启weblogic.shopservice服务 -->
<target name="restart.server">
<sshexec host="${www.weblogic.host}" username="${www.weblogic.user}" password="${www.weblogic.password}"
trust="true"
command="cd /data/wl/; sh ${serviceName}.sh"/>
</target>
</project>