我正在尝试修改build.xml文件,以便指定要添加到最终编译的jar中的外部jar。
这是我的build.xml文件
<project name="cmmdcservice" default="all">
<property name="kf.dir" location="E:knopflerfish_osgi_3.4.0"/>
<property name="framework.jar"
location="${kf.dir}/osgi/framework.jar"/>
<target name="all" depends="init,compile,jar"/>
<target name="init">
<mkdir dir="out/classes"/>
</target>
<target name="compile">
<javac destdir = "out/classes"
debug = "on"
srcdir = "src"
includeantruntime="false">
<classpath>
<pathelement location="${framework.jar}"/>
</classpath>
</javac>
</target>
<target name="jar">
<jar basedir = "out/classes"
jarfile = "out/${ant.project.name}.jar"
compress = "true"
includes = "**/*"
manifest = "manifest.mf"/>
</target>
<target name="clean">
<delete dir = "out"/>
</target>
</project>
我想在target name="jar"部分,我需要引用我的外部jar,但实际上不知道如何引用。。有什么想法吗?
您需要添加一个post-jar部分。这里有一个例子:
<target name="-post-jar">
<jar update="true" destfile="${dist.jar}">
<!-- Path to your jar. -->
<zipfileset src="/home/user/javalibs/myjar.jar"/>
</jar>
</target>