forked from zhuomingliang/mmseg4j
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
175 lines (159 loc) · 6.28 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="mmseg4j" default="dist">
<property file="build.properties" />
<property name="project.name" value="${ant.project.name}" />
<property name="src.java.dir" value="src" />
<property name="src.test.dir" value="test" />
<property name="build.dir" value="build" />
<property name="build.java.dir" value="build/classes/java" />
<property name="build.test.dir" value="build/classes/test" />
<property name="build.classes.dir" value="build/classes" />
<property name="extlib.dir" value="lib" />
<property name="ivy.jar.dir" value="${basedir}/ivy" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<property name="lib.dir" location="lib" />
<!-- 定义类路径 -->
<path id="compile.class.path">
<fileset dir="${lib.dir}/compile">
<include name="*.jar" />
</fileset>
</path>
<path id="java.class.path">
<dirset dir="${build.java}">
<include name="**" />
</dirset>
</path>
<target name="resolve" description="--> retrieve dependencies with ivy" depends="install-ivy">
<ivy:retrieve pattern="${ivy.lib.dir}/[conf]/[artifact]-[revision].[ext]" />
</target>
<target name="download-ivy" unless="skip.download">
<mkdir dir="${ivy.jar.dir}" />
<echo message="installing ivy..." />
<get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" dest="${ivy.jar.file}" usetimestamp="true" />
</target>
<target name="install-ivy" depends="download-ivy" description="--> install ivy">
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar" />
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path" />
</target>
<target name="init" depends="resolve">
<mkdir dir="${build.java.dir}" />
</target>
<target name="compile.java" depends="init">
<javac destdir="${build.java.dir}"
debug="true" debuglevel="lines,source"
encoding="UTF-8" source="1.5" target="1.5">
<src path="${src.java.dir}" />
<classpath refid="compile.class.path" />
</javac>
</target>
<target name="compile" depends="compile.java">
</target>
<target name="build.java" depends="compile.java">
<copy todir="${build.java.dir}" preservelastmodified="true">
<fileset dir="${src.java.dir}">
<include name="**/*.*" />
<exclude name="**/*.java" />
</fileset>
</copy>
<copy file="data/chars.dic" todir="${build.java.dir}/data" preservelastmodified="true" />
<copy file="data/units.dic" todir="${build.java.dir}/data" preservelastmodified="true" />
</target>
<target name="dist" depends="build.java,jar,jar-with-dic,jar.core,jar.core-with-dic,jar.analysis,jar.solr" />
<target name="jar" depends="build.java">
<jar destfile="${build.dir}/${project.name}-all-${version}.jar" basedir="${build.java.dir}" >
<manifest>
<attribute name="Main-Class" value="com.chenlb.mmseg4j.example.Complex"/>
</manifest>
</jar>
</target>
<target name="jar-with-dic" depends="build.java">
<copy file="data/words.dic" todir="${build.java.dir}/data" preservelastmodified="true" />
<jar destfile="${build.dir}/${project.name}-all-${version}-with-dic.jar" basedir="${build.java.dir}" >
<manifest>
<attribute name="Main-Class" value="com.chenlb.mmseg4j.example.Complex"/>
</manifest>
</jar>
<delete file="${build.java.dir}/data/words.dic" />
</target>
<target name="jar.core" depends="build.java">
<jar destfile="${build.dir}/${project.name}-core-${version}.jar" basedir="${build.java.dir}" >
<manifest>
<attribute name="Main-Class" value="com.chenlb.mmseg4j.example.Complex"/>
</manifest>
<exclude name="**/analysis/**"/>
<exclude name="**/solr/**"/>
</jar>
</target>
<target name="jar.core-with-dic" depends="build.java">
<copy file="data/words.dic" todir="${build.java.dir}/data" preservelastmodified="true" />
<jar destfile="${build.dir}/${project.name}-core-${version}-with-dic.jar" basedir="${build.java.dir}" >
<manifest>
<attribute name="Main-Class" value="com.chenlb.mmseg4j.example.Complex"/>
</manifest>
<exclude name="**/analysis/**"/>
<exclude name="**/solr/**"/>
</jar>
<delete file="${build.java.dir}/data/words.dic" />
</target>
<target name="jar.analysis" depends="build.java">
<jar destfile="${build.dir}/${project.name}-analysis-${version}.jar" basedir="${build.java.dir}" >
<include name="**/analysis/**"/>
</jar>
</target>
<target name="jar.solr" depends="build.java">
<jar destfile="${build.dir}/${project.name}-solr-${version}.jar" basedir="${build.java.dir}" >
<include name="**/solr/**"/>
</jar>
</target>
<target name="zip" depends="dist">
<delete file="${build.dir}/${project.name}-${version}.zip"></delete>
<!--mkdir dir="temp-zip/lib"/-->
<copy todir="temp-zip/dist" preservelastmodified="true">
<fileset dir="${build.dir}">
<include name="${project.name}-*-${version}.jar"/>
<include name="${project.name}-core-${version}-with-dic.jar"/>
<exclude name="${project.name}-all-${version}.jar"/>
</fileset>
<!--
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
-->
</copy>
<copy todir="temp-zip" preservelastmodified="true">
<fileset dir="${build.dir}">
<include name="${project.name}-all-${version}.jar"/>
<include name="${project.name}-all-${version}-with-dic.jar"/>
</fileset>
<fileset dir="">
<include name="*.txt"/>
<include name="src/**"/>
<!--include name="lib/**"/-->
<include name="data/*.dic"/>
<include name="build.properties"/>
<include name="build.xml"/>
<include name="ivy.xml"/>
</fileset>
</copy>
<zip destfile="${build.dir}/${project.name}-${version}.zip" basedir="temp-zip">
</zip>
<delete dir="temp-zip"></delete>
</target>
<target name="clean">
<delete includeEmptyDirs="true">
<fileset dir="${build.classes.dir}">
<include name="**/*.class" />
</fileset>
</delete>
</target>
<target name="clean-all">
<delete includeEmptyDirs="true" failonerror="off">
<fileset dir="${build.dir}">
<include name="**/*.*"/>
</fileset>
<fileset dir="${build.classes.dir}"></fileset>
</delete>
</target>
</project>