Question

I'm trying to modify the build.xml file in order to specify an external jar to be added to the final compiled jar .

Here is my build.xml file

  <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>

I guess somehow in the target name="jar" section I need to refer to my external jar, but don't actually know how .. any ideas ?

Was it helpful?

Solution

You need to add a post-jar section. Here is an example:

<target name="-post-jar">
  <jar update="true" destfile="${dist.jar}">
    <!-- Path to your jar. -->
    <zipfileset src="/home/user/javalibs/myjar.jar"/>
 </jar>
</target>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top