<?xml version="1.0" encoding="utf-8" ?> <project name="XXXServer" basedir="." default="package"> <property environment="env" /> <property name="drools.dir" value="F:/drools-distribution-6.1.0.Final/binaries" /> <property name="classes.dir" value="bin" /> <property name="lib.dir" value="lib" /> <property name="src.dir" value="src/main/java" /> <property name="resources.dir" value="src/main/resources" /> <property name="output.dir" value="out" /> <property name="conf.dir" value="conf" /> <property name="all.dir" value="all" /> <property name="pack.name" value="eiServer" /> <path id="compile.classpath"> <fileset dir="${lib.dir}"> <exclude name="**/.svn" /> </fileset> <fileset dir="${drools.dir}"/> </path> <target name="clean"> <delete dir="${output.dir}" /> <delete dir="${classes.dir}" /> <delete dir="${all.dir}" /> </target> <target name="compile" depends="clean"> <mkdir dir="${classes.dir}" /> <javac encoding="utf-8" srcdir="${src.dir}" debug="true" includeantruntime="false" classpathref="compile.classpath" destdir="${classes.dir}" /> </target> <target name="package" description="build" depends="compile"> <mkdir dir="${all.dir}" /> <mkdir dir="${all.dir}/rules" /> <copy todir="${all.dir}/rules"> <fileset dir="${resources.dir}/rules" /> </copy> <copy todir="${all.dir}"> <fileset dir="${classes.dir}" /> </copy> <jar destfile="${output.dir}/${pack.name}.jar" basedir="${all.dir}"> <manifest> <attribute name="Main-Class" value="com.xxx.xxx.EiServer" /> </manifest> <metainf dir="${resources.dir}/META-INF" /> </jar> <zip destfile="${output.dir}/${pack.name}.zip" basedir="src"/> </target> </project>
<metainf>用于把dir下面的文件复制到jar包的meta-inf文件夹下
basedir="${all.dir}是打包成jar的目录,一般是bin文件夹,现在需要把rules文件也打包进去,于是创建一个all文件夹,并把bin和rulescopy过去all,然后再打包
时间: 2024-11-25 09:34:41