Gradle: how to get default resources output dir?
println sourceSets.main.resources.outputDir
Error:
Needs to set a non-null value before it can be retrieved
By default, gradle outputs generated source files into build/classes directory.
The Jar is created under the $project/build/libs/ folder.
The Gradle user home directory ( $USER_HOME/.gradle by default) is used to store global configuration properties and initialization scripts as well as caches and log files.
1.1 What is a Gradle SourceSet ? A SourceSet is a collection of java source files and additional resource files that are compiled and assembled together to be executed. The main idea of sourcesets is to group files with a common meaning for the project, with no need of separate them in another project.
For kotlin DSL:
sourceSets.main.get().output.resourcesDir
Try this :
println sourceSets.main.output.resourcesDir
Source
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