4

I'm writing a tiny library which uses a couple of dependencies. One of them is the org.json library.

I want to shade only this org.json library by including the sources in my own jar and relocating them to another repackaged package.

I had a look at the Gradle Shadow plugin but it creates an -all jar. I just want the normal jar and only the org.json lib to be relocated. Is this possible?

Alternative is just copying those classes to my project and checking them in source control.

tkruse
  • 10,222
  • 7
  • 53
  • 80
Marcel Overdijk
  • 11,041
  • 17
  • 71
  • 110
  • from shadow plugin description, you should be able to do anything that the maven shade plugin does, including relocating packages. Does this not help http://imperceptiblethoughts.com/shadow/#relocating_packages ? – RaGe Oct 10 '16 at 19:49
  • Yes I tried that "relocate" option together with the shadowJar task. But then I get only a *-all.jar. I just want a normal my-project.jar with only 1 dependency shaded. – Marcel Overdijk Oct 11 '16 at 07:00
  • 1
    are the shaded packages included in your my-project.jar? Can I re-interpret your question as: how do I exclude un-relocated dependency packages from the output jar? – RaGe Oct 11 '16 at 13:39

0 Answers0