VS Code环境变量,类似于eclipse



在eclipse中可以维护N个带有VM参数和特定环境变量的maven任务

每个都可以用给定的名称单独启动

如何在VS code中实现这一点,是否有任何扩展或json文件,如runner或run with launch with ?

您必须在文件tasks.json的vscode中配置自己的任务。这里有一个非常好的文档。

下面是一个如何调用简单shell脚本的例子:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Run shell script",
"type": "shell",
"command": "./script.sh"
}
]
}

如果你想设置环境变量,你必须使用选项:

{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Run shell script",
"type": "shell",
"command": "./script.sh",
"options": {
"env": {
"PATH": anotherpath;${env:PATH}"
}
}
}
]
}

最新更新