VSC всегда сообщает о нулевом значении, прикрепленном к переменной среды, например:
build.gradle
Код: Выделить всё
ext.gitea_protocol = System.getenv("GITEA_PROTOCOL")
println "protocol: ${gitea_protocol}"
протокол: null
Эта же конфигурация прекрасно работает для действий Gitea.
Я пробовал много разных способов установки переменных env, например:
launch.json
Код: Выделить всё
{
"type": "java",
"name": "Launch Current File",
"request": "launch",
"cwd": "${workspaceFolder}",
"mainClass": "${file}",
"envFile": "${workspaceFolder}/.env",
"env": {
"GITEA_PROTOCOL": "http",
"GITEA_URL": "git.lab:3000",
"gitea_protocol": "http",
"gitea_url": "git.lab:3000",
"protocol": "http",
"url": "git.lab:3000"
}
},
{
"type": "java",
"name": "Run Gradle Task",
"request": "launch",
"mainClass": "",
"projectName": "service",
"args": [
"build",
"init"
],
"vmArgs": [
"GITEA_PROTOCOL=http",
"gitea_protocol=http",
"protocol=http",
]
}
GITEA_URL=git.lab:3000
GITEA_PROTOCOL=http
или в settings.json:
Код: Выделить всё
"java.configuration.runtimes": [
{
"GITEA_PROTOCOL": "http",
"protocol": "http"
}
]
Код: Выделить всё
maven {
name = "Gitea"
url "${gitea_protocol}://${gitea_url}/api/packages/Registry/maven"
allowInsecureProtocol = true
}
Подробнее здесь: https://stackoverflow.com/questions/792 ... -variables
Мобильная версия