Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gradle get resources default output directory

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
like image 240
eastwater Avatar asked Jun 27 '17 20:06

eastwater


People also ask

Where is output of gradle build?

By default, gradle outputs generated source files into build/classes directory.

Where does gradle output jar?

The Jar is created under the $project/build/libs/ folder.

What is .gradle directory?

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.

What is Sourcesets in gradle?

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.


Video Answer


2 Answers

For kotlin DSL:

sourceSets.main.get().output.resourcesDir
like image 67
hongwingl Avatar answered Oct 18 '22 23:10

hongwingl


Try this :

println sourceSets.main.output.resourcesDir

Source

like image 34
ToYonos Avatar answered Oct 18 '22 23:10

ToYonos