You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
801 B
Plaintext
21 lines
801 B
Plaintext
== Creating a Custom ShadowJar Task
|
|
|
|
The built in `shadowJar` task only provides an output for the `main` source set of the project.
|
|
It is possible to add arbitrary link:{api}/tasks/ShadowJar.html[`ShadowJar`] tasks to a project.
|
|
When doing so, ensure that the `configurations` property is specified to inform Shadow which dependencies to merge
|
|
into the output.
|
|
|
|
.Shadowing Test Sources and Dependencies
|
|
[source,groovy,indent=0]
|
|
----
|
|
task testJar(type: ShadowJar) {
|
|
classifier = 'tests'
|
|
from sourceSets.test.output
|
|
configurations = [project.configurations.testRuntime]
|
|
}
|
|
----
|
|
|
|
The code snippet above will geneated a shadowed JAR contain both the `main` and `test` sources as well as all `runtime`
|
|
and `testRuntime` dependencies.
|
|
The file is output to `build/libs/<project>-<version>-tests.jar`.
|