我是一名有用的助手,可以为您翻译文本。
这些是我尝试过但没有成功的当前配置。
“调试”配置会输出以下错误信息。
"Debug Task"配置运行任务,但它会等待任务完成,而任务永远不会完成。因此,我无法调试它。
编辑1:
所以如果我运行这个任务
然后运行此启动配置。
我可以调试应用程序,但这仅会将调试器附加到进程上。因此,在完成调试时,我必须手动终止进程。理想情况下,我希望能够通过启动配置文件在vscode中启动和停止应用程序。
编辑2:
我可以通过IntelliJ配置实现我的目标,但我希望能够在vscode中实现这一点。 编辑3:
这是我当前的配置,效果还不错。我可以使用CMD-SHFT-B然后按F5启动调试器来启动程序。
我正在尝试通过VSCode调试Spring bootRun应用程序。我不确定正确的启动配置是什么。
这是我在终端中启动程序的方式
./gradlew bootRun -Dspring.profiles.active=local
这些是我尝试过但没有成功的当前配置。
Launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Debug",
"args": [
"bootRun",
"-Dspring.profiles.active=local"
],
"mainClass": "com.test.Application",
"request": "launch"
},
{
"type": "java",
"preLaunchTask": "gradle",
"name": "Debug Task",
"request": "attach",
"hostName": "localhost",
"port": 5005
}
]
}
Tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "gradle",
"type": "shell",
"command": "./gradlew",
"args": [
"bootRun",
"-Dspring.profiles.active=local",
"--debug-jvm"
],
"problemMatcher": []
}
]
}
“调试”配置会输出以下错误信息。
No active profile set, falling back to default profiles: default
"Debug Task"配置运行任务,但它会等待任务完成,而任务永远不会完成。因此,我无法调试它。
编辑1:
所以如果我运行这个任务
{
"version": "2.0.0",
"tasks": [
{
"label": "gradle",
"type": "shell",
"command": "./gradlew",
"args": [
"bootRun",
"-Dspring.profiles.active=local",
"--debug-jvm"
],
"problemMatcher": []
}
]
}
然后运行此启动配置。
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "task 2",
"request": "attach",
"hostName": "localhost",
"port": 5005
}
]
}
我可以调试应用程序,但这仅会将调试器附加到进程上。因此,在完成调试时,我必须手动终止进程。理想情况下,我希望能够通过启动配置文件在vscode中启动和停止应用程序。
编辑2:
我可以通过IntelliJ配置实现我的目标,但我希望能够在vscode中实现这一点。 编辑3:
这是我当前的配置,效果还不错。我可以使用CMD-SHFT-B然后按F5启动调试器来启动程序。
Launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Debug",
"request": "attach",
"hostName": "localhost",
"port": 5005
}
]
}
Tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "gradle",
"type": "shell",
"command": "./gradlew",
"args": [
"bootRun",
"-Dspring.profiles.active=local",
"--debug-jvm"
],
"dependsOn": [
"kill-java"
],
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "kill-java",
"type": "shell",
"command": "pkill",
"args": [
"java"
]
}
]
}