lsp-java icon indicating copy to clipboard operation
lsp-java copied to clipboard

vmArgs field in the launch.json file is not parsed or used.

Open bayang opened this issue 1 year ago • 2 comments

Describe the bug vmArgs field in the launch.json file is not parsed or used.

Emacs 29.1 + latest doom emacs

To Reproduce

using a launch.json file that works in vscode to launch a spring boot app. The vmArgs field is used to set the config location. If this field is not set the app can't start.

Case 1, not working, I used this file :

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "java",
            "name": "launch-from-json",
            "request": "launch",
            "args" : "",
            "vmArgs": "-Dspring.config.location=classpath:application.properties,file:/home/user/perso/app-data/app.properties",
            "mainClass": "io.github.me.app.App",
            "projectName": "my-app"
        }
    ]
}

output in lsp-log buffer, vmArgs is null :

31 janv. 2024, 08:31:48 Launching debuggee VM succeeded.
31 janv. 2024, 08:31:59 Debug connection closed
31 janv. 2024, 08:32:17 Trying to launch Java Program with options:
main-class: io.github.me.app.App
args: 
module-path: 
class-path: /home/user/perso/app-data/target/classes:/home/user/.m2/repository/org/springframework/...blah
vmArgs: null
31 janv. 2024, 08:32:17 Launching debuggee VM succeeded

If instead, I put the config line in the args, like in the modified launch.json file below then it works, the app starts :

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "java",
            "name": "launch-from-json",
            "request": "launch",
            "args" : "--spring.config.location=classpath:application.properties,file:/home/user/perso/app-data/app.properties",
            "vmArgs": "",
            "mainClass": "io.github.me.app.App",
            "projectName": "my-app"
        }
    ]
}

logs from lsp-log buffer, args is set :

31 janv. 2024, 08:32:21 Debug connection closed
31 janv. 2024, 08:33:59 Trying to launch Java Program with options:
main-class: io.github.bayang.diarycompanion.App
args: --spring.config.location=classpath:application.properties,file:/home/user/perso/app-data/app.properties
module-path: 
class-path: /home/user/perso/app-data/target/classes:/home/user/.m2/repository/org/springframework/blah
vmArgs: null
31 janv. 2024, 08:33:59 Launching debuggee VM succeeded.

I also tried to fill args AND vmArgs in the json file and the output in the lsp-log is same as above : args is filled but vmArgs is null.

bayang avatar Jan 31 '24 07:01 bayang

I believe these should be a vector, not a string.

yyoncho avatar Jan 31 '24 10:01 yyoncho

Ok, I tried to modify my json like this :

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "java",
            "name": "launch-from-json-vec",
            "request": "launch",
            "args" : "",
            "vmArgs": ["-Dspring.config.location=classpath:application.properties,file:/home/user/perso/app-data/appproperties"],
            "mainClass": "io.github.me.appApp",
            "projectName": "my-app
        }
    ]
}

The app does not start and Lsp logs output this :

31 janv. 2024, 12:05:53 Debug connection closed
31 janv. 2024, 12:06:13 Trying to launch Java Program with options:
main-class: io.github.me.appApp
args: 
module-path: 
class-path: /home/user/perso/app-data/target/classes:/home/ubik/.m2/repository/org/springframework/org/blah
vmArgs: null
31 janv. 2024, 12:06:13 Launching debuggee VM succeeded.

bayang avatar Jan 31 '24 11:01 bayang