【问题标题】:gradle get resources default output directorygradle 获取资源默认输出目录
【发布时间】:2017-12-01 01:20:40
【问题描述】:

Gradle:如何获取默认资源输出目录?

println sourceSets.main.resources.outputDir

错误:

Needs to set a non-null value before it can be retrieved

【问题讨论】:

    标签: gradle directory resources output source-sets


    【解决方案1】:

    试试这个:

    println sourceSets.main.output.resourcesDir
    

    Source

    【讨论】:

    【解决方案2】:

    对于 kotlin DSL:

    sourceSets.main.get().output.resourcesDir
    

    【讨论】:

    • sourceSets.main.get().output.resourcesDirFile 类型。要将其转换为字符串,我们应该调用sourceSets.main.get().output.resourcesDir.toString()
    猜你喜欢
    • 2018-09-13
    • 1970-01-01
    • 2019-03-02
    • 2022-10-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-30
    • 1970-01-01
    相关资源
    最近更新 更多