![](https://img.laitimes.com/img/9ZDMuAjOiMmIsIjOiQnIsIyZuBnL3czM0MzMzIWMhdTZtQTMllTLldTMz0CZzkDOtETYwkzM1YjZvwFOxgjM4UzLcRnbl1GajFGd0F2LcRWYvxGc19CXt92YuUWelRXauwGZvw1LcpDc0RHaiojIsJye.png)
<project name="build_rtf" default="jar" basedir=".">
<!-- class文件路径-->
<property name="class.dir" value="bin"/>
<!-- 生成的jar存放路径-->
<property name="build.dir" value="jar" />
<!--生成的jar文件名称-->
<property name="jar.name" value="uc.jar" />
<!--依赖的jar-->
<property name="lib" value="lib" />
<!--可执行jar需要指定入口类-->
<property name="mainclass" value="com.inspur.uc.hsfserver" />
<path id="classpath">
<fileset dir="${lib}" includes="**/*.jar"/>
</path>
<target name="init">
<echo message="+--- init start ---+" />
<tstamp />
<delete dir="${build.dir}" />
<mkdir dir="${build.dir}" />
<echo message="+--- init end ---+" />
</target>
<target name="jar" depends="init" >
<echo message="+--- jar *.class files start ---+" />
<pathconvert property="mf.classpath" pathsep=" lib/">
<path refid="classpath" />
<flattenmapper />
</pathconvert>
<jar destfile="${build.dir}/${jar.name}" update="true">
<fileset dir="${class.dir}" includes="com/**">
</fileset>
<fileset dir="${class.dir}" includes="org/**">
<manifest>
<attribute name="main-class" value="${mainclass}"/>
<attribute name="class-path" value="./ lib/${mf.classpath}"/>
</manifest>
</jar>
<echo message="+--- jar *.class files end ---+" />
</project>