Integrating with Groovy and Scala Plugins¶
Shadow also works well for Groovy and Scala, here are integration examples:
For Groovy:
plugins {
groovy
id("com.gradleup.shadow")
}
tasks.shadowJar {
manifest {
// Optionally, set the main class for the shadowed JAR.
attributes["Main-Class"] = "com.example.Main"
}
}
plugins {
id 'groovy'
id 'com.gradleup.shadow'
}
tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
manifest {
// Optionally, set the main class for the shadowed JAR.
attributes 'Main-Class': 'com.example.Main'
}
}
For Scala:
plugins {
scala
id("com.gradleup.shadow")
}
tasks.shadowJar {
manifest {
// Optionally, set the main class for the shadowed JAR.
attributes["Main-Class"] = "com.example.Main"
}
}
plugins {
id 'scala'
id 'com.gradleup.shadow'
}
tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
manifest {
// Optionally, set the main class for the shadowed JAR.
attributes 'Main-Class': 'com.example.Main'
}
}
You can customize the other configurations of the shadowJar task as needed, just like with Java projects.