GradleUp / shadow

Gradle plugin to create fat/uber JARs, apply file transforms, and relocate packages for applications and libraries. Gradle version of Maven's Shade plugin.
https://www.gradleup.com/shadow/
Apache License 2.0
3.72k stars 392 forks source link

Update user guide to include example usage of shadow plugin with the Gradle Development Plugin #380

Open mkobit opened 6 years ago

mkobit commented 6 years ago

Using the 'java-gradle-plugin' (from https://docs.gradle.org/current/userguide/java_gradle_plugin.html) should be documented as it is generally the preferred way to build, test, and publish plugins in more recent versions of Gradle.

johnrengelman commented 6 years ago

Pull requests welcome for documentation

fitzoh commented 6 years ago

I'm interested to see any tips on this one... I've been struggling for a while now to figure out how to get the shadow (or plugin-shadow), java-gradle-plugin, and maven-publish to play nice and publish the shadowjar instead of the regular jar.

stewartbryson commented 6 years ago

@fitzoh Just curious if you made any progress on this. I'm thinking of using plugin-shadow as a way to publish a plugin that includes libraries not existent in jcenter. Wondering if this is a reasonable use case, whether it's possible, and if you had success.

fitzoh commented 6 years ago

Sorry @stewartbryson, no luck here

maguro commented 6 years ago

I've had a fair bit of luck doing this. I can take a stab at documentation. How do I submit docs?

mkobit commented 6 years ago

@maguro It looks like (to me) an AsciiDoctor site at https://github.com/johnrengelman/shadow/tree/master/src/docs/asciidoc gets built/published with GitHub pages at https://github.com/johnrengelman/shadow/tree/gh-pages . Looking at https://github.com/johnrengelman/shadow/commit/5617cb70b05e41c07fc309f0b9b4e43c678d3079 , those pages are generated by one of the Gradle plugins applied and running a command in the repository.

Hopefully that is helpful/accurate. I think probably submitting a PR for the asciidoc would probably be the right path.

stewartbryson commented 6 years ago

@maguro Any teaser snippets?

stewartbryson commented 6 years ago

Thanks anyway @fitzoh

johnrengelman commented 6 years ago

This plugin itself uses java-gradle-plugin, shadow-plugin, and maven-publish plugins and publishes the shadowed jar file. See the build.gradle and gradle/publish.gradle files in this project.

stewartbryson commented 6 years ago

That’s so meta. 😉 Thanks @johnrengelman I’ll take a look.

stewartbryson commented 6 years ago

@johnrengelman Saw the note on removing plugin-shadow with a preference not just using shadow. That makes sense. It's a lack of knowledge, but I don't necessarily understand the need for the Relocate need, and how it relates to Plugins. I assume that during dependency resolution, a class that has been shaded inside the JAR would take precedence over the POM. Is that what the Relocation does... update the POM reference to the class inside the JAR?

Thanks for a great plugin.

johnrengelman commented 6 years ago

The relocate task does scanning of your classpath and sets up all the packages it finds to be relocated. This removes the need of having to define each package relocation manually in the shadow task config.

It’s useful if you are writing a Gradle plugin because Gradle plugins have a tendency at to leak classes (getting better)