Skip to content

Commit

Permalink
Tweak the doc about packaging Gradle plugins (GradleUp#1143)
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler authored Jan 11, 2025
1 parent f94417c commit 1fb1eaf
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/docs/plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ and `relocationPrefix` settings on any `ShadowJar` task.
A simple Gradle plugin can use this feature by applying the `shadow` plugin and configuring the `shadowJar` task for relocation.

```groovy
dependencies {
shadow localGroovy()
shadow gradleApi()
apply plugin: 'java-gradle-plugin'
apply plugin: 'com.gradleup.shadow'
dependencies {
implementation 'org.jdom:jdom2:2.0.6'
implementation 'org.ow2.asm:asm:6.0'
implementation 'org.ow2.asm:asm-commons:6.0'
Expand All @@ -25,14 +25,10 @@ dependencies {
tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
enableRelocation = true
archiveClassifier = ''
}
```

Note that the `localGroovy()` and `gradleApi()` dependencies are added to the `shadow` configuration instead of the
normal `compile` configuration. These 2 dependencies are provided by Gradle to compile your project but are ultimately
provided by the Gradle runtime when executing the plugin. Thus, it is **not** advisable to bundle these dependencies
with your plugin.

## Publishing shadowed Gradle plugins
The Gradle Publish Plugin introduced support for plugins packaged with Shadow in version 1.0.0.
Starting with this version, plugin projects that apply both Shadow and the Gradle Plugin Publish plugin will be
Expand Down

0 comments on commit 1fb1eaf

Please sign in to comment.