gradle get resources default output directory
Asked Answered
M

2

15

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
Melvinmelvina answered 27/6, 2017 at 20:48 Comment(0)
G
25

Try this :

println sourceSets.main.output.resourcesDir

Source

Gi answered 27/6, 2017 at 21:5 Comment(1)
Link to docs: docs.gradle.org/current/dsl/…Vociferous
R
5

For kotlin DSL:

sourceSets.main.get().output.resourcesDir
Roadster answered 28/12, 2021 at 12:40 Comment(1)
sourceSets.main.get().output.resourcesDir is a File type. To cast it to String, we should call sourceSets.main.get().output.resourcesDir.toString()Gobi

© 2022 - 2024 — McMap. All rights reserved.