Questions tagged [jarjar]

Jar Jar Links is a utility that makes it easy to repackage Java libraries and embed them into your own distribution.

Jar Jar Links is a utility that makes it easy to repackage Java libraries and embed them into your own distribution. This is useful for two reasons:

You can easily ship a single jar file with no external dependencies. You can avoid problems where your library depends on a specific version of a library, which may conflict with the dependencies of another library. How does it work?

Jar Jar Links includes an Ant task that extends the built-in jar task. The normal zipfileset element is used to embed jar files. A new rule element is added which uses wildcards patterns to rename the embedded class files. Bytecode transformation (via ASM) is used to change references to the renamed classes, and special handling is provided for moving resource files and transforming string literals.

28 questions
14
votes
3 answers

Android: error including/repacking dependencies which reference javax core classes

I'm working on an Android app using Maven as the build tool. I managed to set evertyhing up correctly (maven dependencies are exported to the apk etc.), however I have one remaining problem which is driving me crazy. I want to include a dependency…
thomaux
  • 19,133
  • 10
  • 76
  • 103
11
votes
3 answers

How can I use a zipfileset src attribute without having to specify it manually for all my jars?

I currently have this: The problem is I have to manually specify each jar, because I need the src parameter to be taken in…
Geo
  • 93,257
  • 117
  • 344
  • 520
11
votes
3 answers

How to create a JarJar'd artifact with Maven, where use of artifact does not pull transitive dependencies?

I currently have a Java testing library which is built with Maven, and distributed as a jar. My project depends on a very common library (Objectweb ASM), and I've experienced problems where an earlier and incompatible version of ASM is already on…
Grundlefleck
  • 124,925
  • 25
  • 94
  • 111
8
votes
1 answer

Exclude empty directories with Jar Jar Links

I am using an Ant task from Jar Jar Links to embed classes from a 3rd-party jar file (objenesis) in my distributable jar file (example.jar). Jar Jar will translate classes from the original package (org.objenesis) to one of my choosing. It works but…
Michael Easter
  • 23,733
  • 7
  • 76
  • 107
8
votes
1 answer

How to use JarJar with Android to change package names of external jars?

I can't seem to find any clear instructions on how to use JarJar with an Android project. I've got a scenario where my application project relies on two separate libraries, which both happen to use the same external .jar files. If I try to compile…
Sent1nel
  • 509
  • 1
  • 7
  • 21
5
votes
1 answer

How to repackage .class files from the default package using jarjar?

Is it possible to move the .class files in a jar from the default package to another named package so that I can import and use them? After browsing other questions here, I think jarjar might be exactly what im looking for, but I don't have any idea…
YLivay
  • 125
  • 1
  • 8
5
votes
1 answer

How to repackage HttpClient 4.3.1 and remove dependencies on commons-logging?

I want to repackage apache's httpclient lib to ship it with an android app (like https://code.google.com/p/httpclientandroidlib/ but with HttpClient 4.3.1) Therefore, I downloaded the httpclient 4.3.1 jar (includes all its dependencies) by hand and…
Stuck
  • 11,225
  • 11
  • 59
  • 104
5
votes
3 answers

How to use jarjar from the command-line?

I'm having trouble using jarjar from the command-line to combine a simple Scala program with the scala runtime-library. jarjar correctly detects the dependency: $ java -jar ~/Desktop/saug/jarjar-1.0.jar find jar BCT.jar…
Mark Probst
  • 7,107
  • 7
  • 40
  • 42
4
votes
1 answer

JarJar not renaming references

I'm using Google's jarjar to repackage dependencies in my application's fat jar. On running the repackaged jar, I get NoClassDefFoundError eg: Exception in thread "main" java.lang.NoClassDefFoundError: ch/qos/logback/classic/LoggerContext Caused by:…
Nitin Labhishetty
  • 1,290
  • 2
  • 21
  • 41
3
votes
1 answer

Relocating fastxml.jackson classes to my.package.fastxml.jackson

I'm trying to relocate the packages from "com.fasterxml.jackson" into my own package (ie, "mypackage.com.fasterxml.jackson") and then consume it in another JAR which I own. I've managed to run the maven-shade plugin to do it using this…
nadavy
  • 1,755
  • 1
  • 18
  • 33
3
votes
1 answer

JarJar with Ant - how to use a Rule file

I would like to know how to run JarJar with Ant, passing the rules in with an external Rules file. 1) I know I can pass the rules in one by one as below:
Richard Le Mesurier
  • 29,432
  • 22
  • 140
  • 255
2
votes
0 answers

Plugin 'org.anarres.jarjar' or equivalent jarjar-gradle tool for android gradle v7.0 compatibility support

Please refer to aTalk, an open source project for more info. aTalk is an xmpp-client app for android. It relies on many third parties libraries e.g. smack, and ice4j etc for its features implementation. Currently aTalk uses jarjar-gradle tool to…
2
votes
0 answers

how to use jarjar in android gradle

I am trying to import some java code to android. The problem is that i have dependencies { compile ('com.sun.jersey:jersey-bundle:1.19'){ exclude group :'javax.ws.rs' }; compile ('javax.xml.crypto:jsr105-api:1.0.1') compile…
Deepak Negi
  • 893
  • 10
  • 19
2
votes
3 answers

Repackaging the .jar file

I need to add some jars from JRE7 library to my Android project. But for example rt.jar is in conflict with android.jar from Adroid 2.2 SDK, so I get this error: Ill-advised or mistaken usage of a core class (java.* or javax.*) when not building…
alex
  • 10,900
  • 15
  • 70
  • 100
1
vote
1 answer

Shrinking jar with its dependencies

I have a bunch of jars as a.jar, b.jar, c.jar, d.jar. a.jar is using remaining jars. I am using Test.java in a.java and remaining jars are used by a.java. I would like to make a tiny jar which is including only necessary classes. Actually I have…
Ozgur
  • 137
  • 2
  • 16
1
2