Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 99131

How do I debug a Maven project in VS Code?

$
0
0

I'm using VS Code to write Java, with the Maven build plugin. It's going fine after a lot of fiddling with configuration, except for debugging. The debug configuration looks something like this:

// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
    {
        "type": "java",
        "name": "Debug (Launch) - Current File",
        "request": "launch",
        "mainClass": "${file}"
    },
    {
        "type": "java",
        "name": "Debug (Launch)-App<music-03>",
        "request": "launch",
        "mainClass": "ptcs.App",
        "projectName": "music-03"
    }

When I launch the debugger with the second configuration, debugging my project app (not launching the current file), I get an error:

~/Sync/projects/music/music-03:cd /Users/Mike/Sync/projects/music/music-03 ; /Library
/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/bin/java 
-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:58363 
-Dfile.encoding=UTF-8 @/var/folders/pn/3p41p2fj14d50n707c7x2p4c0000gn
/T/cp_90sfb6m3zinsbhwyvyknqb5hv.argfile ptcs.App 

Error: Could not find or load main class
@.var.folders.pn.3p41p2fj14d50n707c7x2p4c0000gn.T.cp_90sfb6m3zinsbhwyvyknqb5hv.argfile

Note that I have no trouble running the maven compile and package goals, and I even can produce an executable jar packaged with dependencies. My pom.xml is a bit long to reproduce here, but if anyone can give me a hint what I should post from it, I will do so.


Viewing all articles
Browse latest Browse all 99131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>