How to access environment variables in gradle java build script

前端 未结 1 1644
无人及你
无人及你 2021-02-13 13:11

How can I access environment variables (either user level or system level) in gradle java build script.
I am new to gradle and I am trying to build my project using the grad

1条回答
  •  灰色年华
    2021-02-13 13:39

    try this way System.getenv("env var name") like

    home = System.getenv('Third_Party')
    
    task env_read << {
        println "$System.env.HOME"
        //Other way of accessing the environment variable.
        println  System.getenv('Third_Party')
    }
    

    0 讨论(0)
提交回复
热议问题