vscode-maven
vscode-maven copied to clipboard
When debugging in VSCode, maven dependencies with "test-scope" are not available
Describe the bug When i debug a maven based java application in VSCode the dependencies which are defined in the "test-scope" are not loaded and therefore it is not possible to debug an application when a component is needed which is marked for the test-scope. A workaround is to remove the test-scope, but then it is also part of my productive deployment which is not my goal. Another workaround is probably using maven profiles. But this increased the complexity.
To Reproduce Steps to reproduce the behavior:
- Create a maven based project
- Create the H2 dependeny with scope test e.g.
<groupId>com.h2database</groupId> <artifactId>h2</artifactId> 1.4.200 test - Create an application (e.g. spring boot) which use H2 (example is here)
- Run debug
- Application will fail when connecting
Expected behavior A switch/option/setting to define the maven scope when debugging an application.
Environments (please complete the following information as much as possible):
- OS: Windows 10
- VS Code version: 1.48.2
- Extension version Java extension pack 0.10.0
When i debug a maven based java application in VSCode the dependencies which are defined in the "test-scope" are not loaded and therefore it is not possible to debug an application when a component is needed which is marked for the test-scope.
It's more related to Java debugger, you'd better open the issue there to get more help.
/cc @testforstephen
When running a normal application, the debugger won't include the dependencies marked as test scope. This is by design.
If you reference the doc at https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope, test scope should only be for test purpose.
- test This scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases. This scope is not transitive.