How to use gradle properties in build.gradle

前端 未结 3 1364
陌清茗
陌清茗 2021-02-03 21:46

When I run this task:

task tmpTask << {
    project.properties.each {println \"   $it\"}
}

I see:

org.gradle.java.home=/u         


        
3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-03 21:56

    project.properties is a Map

    So you can use

    project.properties['org.gradle.java.home']
    

    You can also use the property() method (but that looks in additional locations):

    project.property('org.gradle.java.home')
    

提交回复
热议问题