I am using the ShadowJar Gradle plugin to build a Jar containing all of the source files in the src/main/java directory and other Jar files in a lib directory and it is working fine. What I need is another ShadowJar task, a devShadowJar task, that will instead of pulling in a JSON file in the src/main/resources folder, it will pull in a JSON file in the src/dev/resources folder.
I added this to the build.gradle file to define the dev source set:
sourceSets {
dev
}
But now I am not sure how to create a devShadowJar task to use the dev JSON resource instead of the JSON resource file located in src/main/resources.
try playing around this:
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
task devShadowJar(type: ShadowJar) {
zip64 true
from './build/classes/java/main'
from project.configurations.compile
from './src/dev/resources' // or wherever the resources and up under ./build
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With