Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging for Java Visual Studio Code extension does not support class path wildcards #1503

Closed
aubreyyan opened this issue Aug 13, 2024 · 1 comment

Comments

@aubreyyan
Copy link

aubreyyan commented Aug 13, 2024

Class path wildcards are officially an option in Java: https://docs.oracle.com/javase/6/docs/technotes/tools/windows/classpath.html

Specifying target/dependency/* as a class path option is common practice and highly suggested as a method of collecting .m2 jars. See https://stackoverflow.com/a/6079820/8652920

Therefore, this functionality should be easily accessible when specifying classpaths in launch.json. This is not the case, however, and asterisks seem to be prematurely escaped.

Environment
  • Operating System: Linux x64
  • JDK version: openjdk version "17.0.12" 2024-07-16
  • Visual Studio Code version: 1.85.2
  • Java extension version: v22.1.1
  • Java Debugger extension version: v0.58.0
Steps To Reproduce
  1. Create a "java" launch configuration (if you're not sure how, ref https://stackoverflow.com/questions/63711388/how-do-i-provide-launch-option-args-to-vscode-java-debugger) with the "classPaths" option specified, and add the path "$project_src/target/dependency/*"
  2. Specify "shortenCommandLine": "none" to see the full command in terminal
  3. Run and debug, and examine the -cp value generated by this extension
  4. You will see target/dependency/\*
Current Result

cd /path/to/maven/project ; /usr/bin/env /usr/lib/jvm/java-17-openjdk-amd64/bin/java -agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:45743 -DconfigFile=src/main/resources/properties/config.properties -Dno_system_volume=true -XX:+ShowCodeDetailsInExceptionMessages -cp /path/to/maven/project/target/dependency/\* com.my.project.Main

Expected Result

cd /path/to/maven/project ; /usr/bin/env /usr/lib/jvm/java-17-openjdk-amd64/bin/java -agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:45743 -DconfigFile=src/main/resources/properties/config.properties -Dno_system_volume=true -XX:+ShowCodeDetailsInExceptionMessages -cp /path/to/maven/project/target/dependency/* com.my.project.Main

Additional Informations
@aubreyyan
Copy link
Author

It appears that I made a typo in dependency and using exactly $project_src/target/dependency/* does expand properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant