在 Gradle 中,有没有更好的方法来获取环境变量? [英] In Gradle, is there a better way to get Environment Variables?
本文介绍了在 Gradle 中,有没有更好的方法来获取环境变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在几个任务中,我引用了我的主文件夹中的 jar.
In several Tasks, I reference jars in my home folder.
有没有比
ENV = System.getenv()
HOME = ENV['HOME']
task copyToServer(dependsOn: 'jar', type: Copy) {
from 'build/libs/'
into HOME + "/something/plugins/"
}
这设置了 $HOME 但我希望我错过了文档中的一些魔法.
This sets $HOME but I was hoping that I missed some magic from the documentation.
推荐答案
好吧;这也有效:
home = "$System.env.HOME"
不清楚你的目标是什么.
It's not clear what you're aiming for.
这篇关于在 Gradle 中,有没有更好的方法来获取环境变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文