Skip to content

Commit 3c6d506

Browse files
GooolerCopilot
andauthored
Use more footnotes in docs (#1400)
Co-authored-by: Copilot <[email protected]>
1 parent 7e1ff42 commit 3c6d506

File tree

12 files changed

+209
-142
lines changed

12 files changed

+209
-142
lines changed

docs/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Shadow is a Gradle plugin for combining a project's dependency classes and resources into a single
99
output Jar.
1010
The combined Jar is often referred to a _fat-jar_ or _uber-jar_.
11-
Shadow utilizes [`JarInputStream`](https://docs.oracle.com/javase/8/docs/api/java/util/jar/JarInputStream.html) and [`JarOutputStream`](https://docs.oracle.com/javase/8/docs/api/java/util/jar/JarOutputStream.html) to efficiently process dependent libraries
11+
Shadow utilizes [`JarInputStream`][JarInputStream] and [`JarOutputStream`][JarOutputStream] to efficiently process dependent libraries
1212
into the output jar without incurring the I/O overhead of expanding the jars to disk.
1313

1414
!!! warning "Plugin ID Change"
@@ -57,3 +57,8 @@ These issues often manifest themselves as binary incompatibilities in either the
5757

5858
By utilizing Shadow's ability to _relocate_ the package names for dependencies, a library author can ensure that the
5959
library's dependencies will not conflict with the same dependency being declared by the downstream application.
60+
61+
62+
63+
[JarInputStream]: https://docs.oracle.com/javase/8/docs/api/java/util/jar/JarInputStream.html
64+
[JarOutputStream]: https://docs.oracle.com/javase/8/docs/api/java/util/jar/JarOutputStream.html

docs/application-plugin/README.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Integrating with Application Plugin
22

3-
Shadow reacts to the presence of Gradle's
4-
[`application`](https://docs.gradle.org/current/userguide/application_plugin.html) plugin and will automatically
5-
configure additional tasks for running the shadowed JAR and creating distributions containing the shadowed JAR.
3+
Shadow reacts to the presence of Gradle's [`application`][application] plugin and will automatically configure
4+
additional tasks for running the shadowed JAR and creating distributions containing the shadowed JAR.
65

7-
Just like the normal `jar` task, when the `application` plugin is applied, the `shadowJar` manifest will be
8-
configured to contain the `Main-Class` attribute with the value specified in the project's `mainClassName` attribute.
6+
Just like the normal [`Jar`][Jar] task, when the [`application`][application] plugin is applied,
7+
the [`ShadowJar`][ShadowJar] manifest will be configured to contain the `Main-Class` attribute with the value specified
8+
in the project's `application.mainClass` attribute.
99

1010
=== "Kotlin"
1111

@@ -37,9 +37,8 @@ configured to contain the `Main-Class` attribute with the value specified in the
3737

3838
When applied along with the `application` plugin, the `runShadow` task will be created for starting
3939
the application from the shadowed JAR.
40-
The `runShadow` task is a [`JavaExec`](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.JavaExec.html)
41-
task that is configured to execute `java -jar myproject-all.jar`.
42-
It can be configured the same as any other `JavaExec` task.
40+
The `runShadow` task is a [`JavaExec`][JavaExec] task that is configured to execute `java -jar myproject-all.jar`.
41+
It can be configured the same as any other [`JavaExec`][JavaExec] task.
4342

4443
=== "Kotlin"
4544

@@ -81,10 +80,9 @@ It can be configured the same as any other `JavaExec` task.
8180

8281
## Distributing the Shadow JAR
8382

84-
The Shadow plugin will also configure distribution tasks when in the presence of the `application` plugin.
85-
The plugin will create `shadowDistZip` and `shadowDistTar` which creates Zip and Tar distributions
86-
respectively.
87-
Each distribution will contain the shadowed JAR file along with the necessary start scripts to launch
83+
The Shadow plugin will also configure distribution tasks when in the presence of the [`application`][application]
84+
plugin. The plugin will create `shadowDistZip` and `shadowDistTar` which creates Zip and Tar distributions
85+
respectively. Each distribution will contain the shadowed JAR file along with the necessary start scripts to launch
8886
the application.
8987

9088
Additionally, the plugin will create the `installShadowDist` and `startShadowScripts` tasks which stages the necessary
@@ -142,5 +140,12 @@ You can also add more files into the distribution like:
142140
}
143141
```
144142

145-
View [the official doc described](https://docs.gradle.org/current/userguide/distribution_plugin.html#distribution_plugin)
143+
View [The Distribution Plugin](https://docs.gradle.org/current/userguide/distribution_plugin.html#distribution_plugin)
146144
for more information about configuring distributions.
145+
146+
147+
148+
[Jar]: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html
149+
[JavaExec]: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.JavaExec.html
150+
[ShadowJar]: ../api/shadow/com.github.jengelman.gradle.plugins.shadow.tasks/-shadow-jar/index.html
151+
[application]: https://docs.gradle.org/current/userguide/application_plugin.html

docs/configuration/README.md

Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,32 @@
11
# Configuring Shadow
22

3-
The [`ShadowJar`](../api/shadow/com.github.jengelman.gradle.plugins.shadow.tasks/-shadow-jar/index.html) task type extends from Gradle's
4-
[`Jar`](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html) type.
5-
This means that all attributes and methods available on `Jar` are also available on
6-
[`ShadowJar`](../api/shadow/com.github.jengelman.gradle.plugins.shadow.tasks/-shadow-jar/index.html).
7-
Refer the _Gradle User Guide_ for [Jar](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html) for
8-
details.
3+
The [`ShadowJar`][ShadowJar] task type extends from Gradle's [`Jar`][Jar] type.
4+
This means that all attributes and methods available on [`Jar`][Jar] are also available on [`ShadowJar`][ShadowJar].
5+
96

107
## Configuring Output Name
118

12-
Shadow configures the default `shadowJar` task to set the output JAR's
9+
Shadow configures the default [`ShadowJar`][ShadowJar] task to set the output JAR's
1310

14-
- [`archiveAppendix`](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html#org.gradle.api.tasks.bundling.Jar:archiveAppendix)
15-
- [`archiveBaseName`](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html#org.gradle.api.tasks.bundling.Jar:archiveBaseName)
16-
- [`archiveExtension`](https://docs.gradle.org/current/dsl/org.gradle.jvm.tasks.Jar.html#org.gradle.jvm.tasks.Jar:archiveExtension)
17-
- [`archiveFile`](https://docs.gradle.org/current/dsl/org.gradle.jvm.tasks.Jar.html#org.gradle.jvm.tasks.Jar:archiveFile)
18-
- [`archiveFileName`](https://docs.gradle.org/current/dsl/org.gradle.jvm.tasks.Jar.html#org.gradle.jvm.tasks.Jar:archiveFileName)
19-
- [`archiveVersion`](https://docs.gradle.org/current/dsl/org.gradle.jvm.tasks.Jar.html#org.gradle.jvm.tasks.Jar:archiveVersion)
20-
- [`destinationDirectory`](https://docs.gradle.org/current/dsl/org.gradle.jvm.tasks.Jar.html#org.gradle.jvm.tasks.Jar:destinationDirectory)
11+
- [`archiveAppendix`][archiveAppendix]
12+
- [`archiveBaseName`][archiveBaseName]
13+
- [`archiveExtension`][archiveExtension]
14+
- [`archiveFile`][archiveFile]
15+
- [`archiveFileName`][archiveFileName]
16+
- [`archiveVersion`][archiveVersion]
17+
- [`destinationDirectory`][destinationDirectory]
2118

22-
to the same default values as Gradle does for all `Jar` tasks.
23-
Additionally, it configures the
24-
[`archiveClassifier`](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html#org.gradle.api.tasks.bundling.Jar:archiveClassifier)
25-
to be `all`. The listed ones are not full, you can view all the properties in
26-
[`Jar`](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html).
27-
The output shadowed JAR file will be named with the following format:
19+
to the same default values as Gradle does for all [`Jar`][Jar] tasks. Additionally, it configures the
20+
[`archiveClassifier`][archiveClassifier] to be `all`. The listed ones are not full, you can view all the properties in
21+
[`Jar`][Jar]. The output shadowed JAR file will be named with the following format:
2822

2923
```
3024
archiveBaseName-$archiveAppendix-$archiveVersion-$archiveClassifier.$archiveExtension
3125
```
3226

33-
If working with a Gradle project with the name `myApp` and version `1.0`, the default `shadowJar` task will output a
34-
file at: `build/libs/myApp-1.0-all.jar`. You can override the properties listed above to change the output name of the
35-
shadowed JAR file. e.g.
27+
If working with a Gradle project with the name `myApp` and version `1.0`, the default [`ShadowJar`][ShadowJar] task will
28+
output a file at: `build/libs/myApp-1.0-all.jar`. You can override the properties listed above to change the output name
29+
of the shadowed JAR file. e.g.
3630

3731
=== "Kotlin"
3832

@@ -64,10 +58,10 @@ they are still required for runtime execution.
6458
In these scenarios, Shadow creates a `shadow` configuration to declare these dependencies.
6559
Dependencies added to the `shadow` configuration are **not** bundled into the output JAR.
6660
Think of `configurations.shadow` as unmerged, runtime dependencies.
67-
The integration with the `maven-publish` plugin will automatically configure dependencies added
61+
The integration with the [`maven-publish`][maven-publish] plugin will automatically configure dependencies added
6862
to `configurations.shadow` as `RUNTIME` scope dependencies in the resulting POM file.
6963

70-
Additionally, Shadow automatically configures the manifest of the `shadowJar` task to contain a `Class-Path` entry
64+
Additionally, Shadow automatically configures the manifest of the [`ShadowJar`][ShadowJar] task to contain a `Class-Path` entry
7165
in the JAR manifest.
7266
The value of the `Class-Path` entry is the name of all dependencies resolved in the `shadow` configuration
7367
for the project.
@@ -99,9 +93,9 @@ When deploying a shadowed JAR as an execution JAR, it is important to note that
9993

10094
## Configuring the JAR Manifest
10195

102-
Beyond the automatic configuration of the `Class-Path` entry, the `shadowJar` manifest is configured in a number of ways.
103-
First, the manifest for the `shadowJar` task is configured to __inherit__ from the manifest of the standard `jar` task.
104-
This means that any configuration performed on the `jar` task will propagate to the `shadowJar` tasks.
96+
Beyond the automatic configuration of the `Class-Path` entry, the [`ShadowJar`][ShadowJar] manifest is configured in a number of ways.
97+
First, the manifest for the [`ShadowJar`][ShadowJar] task is configured to __inherit__ from the manifest of the standard [`Jar`][Jar] task.
98+
This means that any configuration performed on the [`Jar`][Jar] task will propagate to the [`ShadowJar`][ShadowJar] tasks.
10599

106100
=== "Kotlin"
107101

@@ -129,7 +123,7 @@ Inspecting the `META-INF/MANIFEST.MF` entry in the JAR file will reveal the foll
129123
Class-Path: /libs/a.jar
130124
```
131125

132-
If it is desired to inherit a manifest from a JAR task other than the standard `jar` task, the `inheritFrom` methods
126+
If it is desired to inherit a manifest from a JAR task other than the standard [`Jar`][Jar] task, the `inheritFrom` methods
133127
on the `shadowJar.manifest` object can be used to configure the upstream.
134128

135129
=== "Kotlin"
@@ -162,8 +156,7 @@ on the `shadowJar.manifest` object can be used to configure the upstream.
162156

163157
## Adding Extra Files
164158

165-
The `shadowJar` task is a subclass of the `Jar` task, which means that the
166-
[Jar.from](https://docs.gradle.org/current/dsl/org.gradle.jvm.tasks.Jar.html#org.gradle.jvm.tasks.Jar:from(java.lang.Object,%20org.gradle.api.Action))
159+
The [`ShadowJar`][ShadowJar] task is a subclass of the [`Jar`][Jar] task, which means that the[`Jar.from`][Jar.from]
167160
method can be used to add extra files.
168161

169162
=== "Kotlin"
@@ -187,3 +180,19 @@ method can be used to add extra files.
187180
}
188181
}
189182
```
183+
184+
185+
186+
[Jar.from]: https://docs.gradle.org/current/dsl/org.gradle.jvm.tasks.Jar.html#org.gradle.jvm.tasks.Jar:from(java.lang.Object,%20org.gradle.api.Action)
187+
[Jar]: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html
188+
[ShadowJar]: ../api/shadow/com.github.jengelman.gradle.plugins.shadow.tasks/-shadow-jar/index.html
189+
[application]: https://docs.gradle.org/current/userguide/application_plugin.html
190+
[archiveAppendix]: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html#org.gradle.api.tasks.bundling.Jar:archiveAppendix
191+
[archiveBaseName]: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html#org.gradle.api.tasks.bundling.Jar:archiveBaseName
192+
[archiveClassifier]: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html#org.gradle.api.tasks.bundling.Jar:archiveClassifier
193+
[archiveExtension]: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html#org.gradle.api.tasks.bundling.Jar:archiveExtension
194+
[archiveFileName]: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html#org.gradle.api.tasks.bundling.Jar:archiveFileName
195+
[archiveFile]: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html#org.gradle.api.tasks.bundling.Jar:archiveFile
196+
[archiveVersion]: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html#org.gradle.api.tasks.bundling.Jar:archiveVersion
197+
[destinationDirectory]: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html#org.gradle.api.tasks.bundling.Jar:destinationDirectory
198+
[maven-publish]: https://docs.gradle.org/current/userguide/publishing_maven.html

docs/configuration/dependencies/README.md

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# Configuring Shadowed Dependencies
22

3-
Shadow configures the default `shadowJar` task to merge all dependencies from the project's `runtimeClasspath` configuration
4-
into the final JAR.
5-
The configurations from which to source dependencies for the merging can be configured using the `configurations` property
6-
of the [`ShadowJar`](../../api/shadow/com.github.jengelman.gradle.plugins.shadow.tasks/-shadow-jar/index.html) task type.
3+
Shadow configures the default [`ShadowJar`][ShadowJar] task to merge all dependencies from the project's `runtimeClasspath` configuration
4+
into the final JAR. The configurations from which to source dependencies for the merging can be configured using the
5+
[`configurations`][ShadowJar.configurations] property of the [`ShadowJar`][ShadowJar] task type.
76

87
=== "Kotlin"
98

@@ -21,18 +20,18 @@ of the [`ShadowJar`](../../api/shadow/com.github.jengelman.gradle.plugins.shadow
2120
}
2221
```
2322

24-
The above code sample would configure the `shadowJar` task to merge dependencies from only the `compileClasspath` configuration.
23+
The above code sample would configure the [`ShadowJar`][ShadowJar] task to merge dependencies from only the `compileClasspath` configuration.
2524
This means any dependency declared in the `runtimeOnly` configuration would be **not** be included in the final JAR.
2625

27-
> Note the literal use of `project.configurations` when setting the `configurations` attribute of a
28-
[`ShadowJar`](../../api/shadow/com.github.jengelman.gradle.plugins.shadow.tasks/-shadow-jar/index.html) task.
26+
> Note the literal use of [`project.configurations`][Project.configurations] when setting the
27+
[`configurations`][ShadowJar.configurations] attribute of a [`ShadowJar`][ShadowJar] task.
2928
This is **required**. It may be tempting to specify `configurations = [configurations.compileClasspath]` but this will not
30-
have the intended effect, as `configurations.compile` will try to delegate to the `configurations` property of the [`ShadowJar`](../../api/shadow/com.github.jengelman.gradle.plugins.shadow.tasks/-shadow-jar/index.html) task instead of the `project`
29+
have the intended effect, as `configurations.compile` will try to delegate to the
30+
[`configurations`][ShadowJar.configurations] property of the [`ShadowJar`][ShadowJar] task instead of the `project`
3131

3232
## Embedding Jar Files Inside Your Shadow Jar
3333

34-
The `shadowJar` task is a subclass of the `Jar` task, which means that the
35-
[Jar.from](https://docs.gradle.org/current/dsl/org.gradle.jvm.tasks.Jar.html#org.gradle.jvm.tasks.Jar:from(java.lang.Object,%20org.gradle.api.Action))
34+
The [`ShadowJar`][ShadowJar] task is a subclass of the [`Jar`][Jar] task, which means that the [`Jar.from`][Jar.from]
3635
method can be used to add extra files.
3736

3837
=== "Kotlin"
@@ -72,12 +71,11 @@ See also [Adding Extra Files](../README.md#adding-extra-files)
7271
## Filtering Dependencies
7372

7473
Individual dependencies can be filtered from the final JAR by using the `dependencies` block of a
75-
[`ShadowJar`](../../api/shadow/com.github.jengelman.gradle.plugins.shadow.tasks/-shadow-jar/index.html) task.
76-
Dependency filtering does **not** apply to transitive dependencies.
74+
[`ShadowJar`][ShadowJar] task. Dependency filtering does **not** apply to transitive dependencies.
7775
That is, excluding a dependency does not exclude any of its dependencies from the final JAR.
7876

7977
The `dependency` blocks provides a number of methods for resolving dependencies using the notations familiar from
80-
Gradle's `configurations` block.
78+
Gradle's [`project.configurations`][Project.configurations] block.
8179

8280
=== "Kotlin"
8381

@@ -306,7 +304,7 @@ You can also use type-safe project accessors or version catalog accessors to fil
306304
### Programmatically Selecting Dependencies to Filter
307305

308306
If more complex decisions are needed to select the dependencies to be included, the
309-
[`dependencies`](../../api/shadow/com.github.jengelman.gradle.plugins.shadow.tasks/-shadow-jar/dependencies.html)
307+
[`ShadowJar.dependencies`][ShadowJar.dependencies]
310308
block provides a method that accepts a `Closure` for selecting dependencies.
311309

312310
=== "Kotlin"
@@ -340,3 +338,12 @@ block provides a method that accepts a `Closure` for selecting dependencies.
340338
}
341339
}
342340
```
341+
342+
343+
344+
[Jar.from]: https://docs.gradle.org/current/dsl/org.gradle.jvm.tasks.Jar.html#org.gradle.jvm.tasks.Jar:from(java.lang.Object,%20org.gradle.api.Action)
345+
[Jar]: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html
346+
[ShadowJar.configurations]: ../../api/shadow/com.github.jengelman.gradle.plugins.shadow.tasks/-shadow-jar/configurations.html
347+
[ShadowJar.dependencies]: ../../api/shadow/com.github.jengelman.gradle.plugins.shadow.tasks/-shadow-jar/dependencies.html
348+
[ShadowJar]: ../../api/shadow/com.github.jengelman.gradle.plugins.shadow.tasks/-shadow-jar/index.html
349+
[Project.configurations]: https://docs.gradle.org/current/dsl/org.gradle.api.Project.html#org.gradle.api.Project:configurations

docs/configuration/filtering/README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
# Filtering Shadow Jar Contents
22

33
The final contents of a shadow JAR can be filtered using the `exclude` and `include` methods inherited from Gradle's
4-
`Jar` task type.
4+
[`Jar`][Jar] task type.
55

6-
Refer to the [Jar](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html) documentation for details
7-
on the various versions of the methods and their behavior.
8-
9-
When using `exclude`/`include` with a `ShadowJar` task, the resulting copy specs are applied to the _final_ JAR
10-
contents.
11-
This means that, the configuration is applied to the individual files from both the project source set or _any_
12-
of the dependencies to be merged.
6+
When using `exclude`/`include` with a [`ShadowJar`][ShadowJar] task, the resulting copy specs are applied to the
7+
_final_ JAR contents. This means that, the configuration is applied to the individual files from both the project
8+
source set or _any_ of the dependencies to be merged.
139

1410
=== "Kotlin"
1511

@@ -28,7 +24,7 @@ of the dependencies to be merged.
2824
```
2925

3026

31-
Excludes and includes can be combined just like a normal `Jar` task, with `excludes` taking precedence over `includes`.
27+
Excludes and includes can be combined just like a normal [`Jar`][Jar] task, with `excludes` taking precedence over `includes`.
3228
Additionally, ANT style patterns can be used to match multiple files.
3329

3430
=== "Kotlin"
@@ -50,3 +46,8 @@ Additionally, ANT style patterns can be used to match multiple files.
5046
exclude 'a2.properties'
5147
}
5248
```
49+
50+
51+
52+
[Jar]: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html
53+
[ShadowJar]: ../../api/shadow/com.github.jengelman.gradle.plugins.shadow.tasks/-shadow-jar/index.html

0 commit comments

Comments
 (0)