forked from majinju/kettle-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
127 lines (112 loc) · 4.51 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
<project name="kettle-manager" default="default" basedir=".">
<description>
打包
</description>
<tstamp prefix="start" />
<!-- 指定环境变量参数为:SystemVariable -->
<property environment="SystemVariable" />
<property name="cr" value="${line.separator}" />
<!-- 修改概率较高的参数 -->
<property name="kettle_dir" location="${SystemVariable.KETTLE_HOME}" />
<property name="temp_dir" value="/tmp/${ant.project.name}" />
<property name="extLib" value="${kettle_dir}/ext-lib" />
<property name="myutils" value="/workspace/myutils/target"/>
<property name="src" location="src/main/java" />
<property name="resources" location="src/main/resources" />
<property name="doc" location="doc" />
<property name="webapp" location="webapp" />
<property name="lib" location="${webapp}/WEB-INF/lib" />
<property name="target" location="${temp_dir}/${ant.project.name}" />
<property name="classes" location="${temp_dir}/classes" />
<property name="port" value="82" />
<target name="init">
<echo>初始化</echo>
<tstamp />
<delete dir="${target}" />
<mkdir dir="${classes}" />
<mkdir dir="${target}" />
<mkdir dir="${target}/doc" />
<mkdir dir="${extLib}" />
<copy todir="${extLib}">
<fileset dir="${myutils}" includes="myutils.jar" />
<fileset dir="${myutils}/ext-lib" includes="**/*.jar" />
</copy>
<!-- 删除扩展的jersey包,与kettle的冲突了 -->
<delete>
<fileset dir="${extLib}" includes="jersey*.jar"/>
<fileset dir="${extLib}" includes="jsr311-api*.jar"/>
</delete>
<copy todir="${target}/lib">
<fileset dir="${lib}" includes="**/*.jar" />
</copy>
</target>
<target name="compile" depends="init">
<echo>编译代码</echo>
<javac srcdir="${src}" destdir="${classes}" debug="true">
<classpath id="cpath">
<fileset dir="${kettle_dir}/lib" includes="*.jar" />
<fileset dir="${extLib}" includes="*.jar" />
<fileset dir="${target}/lib" includes="*.jar" />
<fileset dir="${classes}" includes="*.class" />
</classpath>
</javac>
</target>
<target name="copy" depends="compile">
<echo>拷贝附属文件</echo>
<copy todir="${classes}">
<fileset dir="${resources}" includes="template/**,**/*.png,**/*.xml,**/*.properties"
excludes="default/**,log4j.xml"/>
</copy>
</target>
<target name="jar" depends="copy" description="生成jar包">
<echo>生成jar包</echo>
<jar jarfile="${temp_dir}/${ant.project.name}.jar" basedir="${classes}" includes="**/*" />
</target>
<target name="deploy" depends="jar">
<echo>生成部署包</echo>
<copy todir="${target}/lib">
<fileset dir="${temp_dir}" includes="${ant.project.name}.jar" />
</copy>
<copy todir="${target}/webapp">
<fileset dir="${webapp}" includes="**" excludes="WEB-INF/lib/**,WEB-INF/classes/**"/>
</copy>
<copy todir="${target}">
<fileset file="${doc}/杂物/km.bat"/>
<fileset file="${doc}/杂物/km.sh"/>
<fileset dir="${resources}" includes="default/*" />
<fileset dir="${kettle_dir}" includes="ext-lib/**" />
</copy>
<copy todir="${target}/doc">
<fileset dir="${doc}" includes="**" />
</copy>
<replace dir="${target}" includes="default/**" encoding="UTF-8">
<replacefilter token="@project-name@" value="${ant.project.name}"/>
<replacefilter token="@ext-lib@" value="%KETTLE_HOME%/ext-lib/*"/>
<replacefilter token="@temp-dir@" value="${temp_dir}"/>
<replacefilter token="@host@" value="127.0.0.1"/>
<replacefilter token="@port@" value="${port}"/>
<replacefilter token="@job-view-name@" value="v_job"/>
<replacefilter token="@project-code@" value="KM_LOCALHOST_${port}"/>
</replace>
<replace dir="${target}" includes="km.sh" encoding="UTF-8">
<replacefilter token="@project-name@" value="${ant.project.name}"/>
<replacefilter token="@temp-dir@" value="${temp_dir}"/>
<replacefilter token="@port@" value="${port}"/>
</replace>
<replace dir="${target}" includes="km.bat" encoding="GBK">
<replacefilter token="@project-name@" value="${ant.project.name}"/>
<replacefilter token="@temp-dir@" value="${temp_dir}"/>
<replacefilter token="@port@" value="${port}"/>
</replace>
<zip destfile="${temp_dir}/${ant.project.name}.zip">
<fileset dir="${target}" includes="**"/>
</zip>
<delete dir="${classes}" />
<delete file="${temp_dir}/${ant.project.name}.jar"/>
</target>
<target name="clean">
<echo>删除已经生成的文件</echo>
<delete file="${temp_dir}/${ant.project.name}.zip" />
</target>
<target name="default" depends="clean,deploy" description="默认删除已经生成的文件重新生成" />
</project>