ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josh Stratton <strattonbra...@gmail.com>
Subject Using ant/jarjar to make nested jars flattened
Date Thu, 11 Feb 2010 18:11:33 GMT
I'm using jarjar as I'm told it is useful for bundling jar
dependencies into a single distributable jar file. I have a problem
though in how jars are unzipped. This is probably a simple ANT
question, but I haven't had much luck with finding help on it in java
related forums, so I thought I'd go directly to the source (unless
that is the jarjar site...).

<target name="package">
      <taskdef name="jarjar"
classname="com.tonicsystems.jarjar.JarJarTask"
classpath="./lib/jarjar.jar"/>
      <jarjar jarfile="dist/inkspot.jar">
          <fileset dir="./build/classes"/>
          <!-- <zipfileset src="./lib/scala.library_2.7.5.final.jar"/>
--> // line A
          <zipfileset dir="./lib"/> // line B
          <zipfileset dir="${jogl.dir}"/>
      </jarjar>
  </target>


I'm trying to include the scala library jar into my code. It has six
jars inside of it (scala-swing.jar, scala-library.jar, etc.).

When I run the above target using line A, I get those six jar files
extracted, but they're still jar files, which I thought jarjar would
unpack for me. The other problem is the six jars sit in a './lib'
directory in my inkspot.jar, while I want them at the base dir.

If I run the target using line B, I get the big scala.jar (holding the
six jar files) into the inkspot.jar file at the base directory, but
that doesn't help what jarjar is supposed to fix. I don't want any
jars in the inkspot.jar at all.  I want them all extracted.  I'm
probably misunderstanding how jarjar works or ant in general.

What I found is if I open scala-library.jar and manually add the code
directly into my inkspot.jar, so now the files are unjarred
(inkspot.jar has a dir named scala with .class files in it), my main
code can now find those classes in the classpath when I run the jar
file.

Is there someway to fix my ant script so this scala.jar will extract
each of the six internal jars into the base directory of my
inkspot.jar so there are no jars inside it?

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message