Pez
Pez

Reputation: 1101

How to pack a jar without dependency classes in gradle similar to maven

How to write a gradle script so that the application jar should be packed without dependency classes similar to maven jar package

Upvotes: 7

Views: 2866

Answers (2)

electronix384128
electronix384128

Reputation: 6733

If you are trying to package a jar from your Android app or library: I ran into this question because gradle would include 3rd party libraries into my jar when running gradle assembleRelease.

The contents of the jar then looked like this:

com/android/...
   /myCompany/...

For some reason this did not happen when building for debug. Finally I found that changing:

compile 'com.android.support:recyclerview-v7:23.0.0'

to

provided 'com.android.support:recyclerview-v7:23.0.0'

would not include the 3rd party libs ...

Upvotes: 3

Vampire
Vampire

Reputation: 38734

The application JAR is always without dependencies, except you use special plugins to create a "fat" JAR where the dependencies are included. If you ask how to set up a Gradle build at all, you should start reading the Users Guide.

Upvotes: 4

Related Questions