从Java迁移到Kotlin后,我想调试我的Kotlin Spring引导应用程序,但是Kotlin的launch.json具有与Java不同的配置,例如,我们使用profiles
在环境之间进行切换,并且当我添加"args": "-Dspring.profiles.active=dev"
时得到Property args is not allowed
。在调试控制台中
Internal error: java.lang.IllegalArgumentException: io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.42.Final:compile is not a properly formed Maven/Gradle artifact
[ERROR] java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.42.Final:compile is not a properly formed Maven/Gradle artifact
这是我当前的Kotlin配置:
{
"version": "0.2.0",
"configurations": [
{
"type": "kotlin",
"request": "launch",
"name": "Kotlin Launch",
"projectRoot": "${workspaceFolder}",
"mainClass": "path.to.my.Application",
"args": "-Dspring.profiles.active=dev" // <--- showing error
}
]
}
为了进行比较,这是我的java launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Debug (Launch) - Current File",
"request": "launch",
"mainClass": "${file}",
"args": "-Dspring-boot.run.profiles=dev"
},
{
"type": "java",
"name": "Debug (Launch)",
"request": "launch",
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"mainClass": "path.to.my.application",
"projectName": "spring",
"args": "--spring.profiles.active=dev",
"vmArgs": "-Dspring.profiles.active=dev"
}
]
}
如果我想使用profiles
或args
,什么是Kotlin的正确配置?