VSCode language server - debug test ignores netbeans.jdkhome when launched via test explorer
- Dominant language
- Java
- Stars
- 3.1k
- Forks
- 935
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 17
Description
### Apache NetBeans version
Apache NetBeans 13
### What happened
VS Code 1.66.2 (MacOS 12.3.1) and [Apache Netbeans Language Server](https://marketplace.visualstudio.com/items?itemName=ASF.apache-netbeans-java) v13.0.301.
When launching a test from the Test Explorer (left-hand sidebar in VS Code), either run or debug, netbeans.jdkhome is ignored which causes maven project build failures if warnings as errors is enabled:
```
Changes detected - recompiling the module!
Compiling 15 source files to .../src/app/target/test-classes
-------------------------------------------------------------
COMPILATION WARNING :
-------------------------------------------------------------
system modules path not set in conjunction with -source 11
1 warning
```
I have my netbeans.jdkhome set to JDK11 at `/usr/local/opt/openjdk@11/libexec/openjdk.jdk/Contents/Home` but when launching the test, in the terminal output I can see it's not using that:
```sh
cd .../src/app; JAVA_HOME=/Library/Java/JavaVirtualMachines/temurin-18.jdk/Contents/Home /Users/stewartadam/.vscode/extensions/asf.apache-netbeans-java-13.0.301/nbcode/java/maven/bin/mvn -Dtest=... process-test-classes surefire:test
Scanning for projects...
```
### How to reproduce
1. Install Language Server extension to VS Code
2. Open Java project with JUnit tests in VS Code
3. Click Test Explorer and run or debug tests
### Did this work correctly in an earlier version?
No
### Operating System
MacOS 12.3.1
### JDK
OpenJDK 11 (installed via brew) and temurin 18 (MacOS)
### Apache NetBeans packaging
Apache VSNetBeans for VSCode
### Anything else
_No response_
### Are you willing to submit a pull request?
No
### Code of Conduct
Yes
Contributor guide
Research direction
Reproduce the issue with a Java project containing JUnit tests by launching a test from VS Code's Test Explorer. Inspect the generated Maven command and environment, then verify that both run and debug launches use the configured netbeans.jdkhome JDK instead of the system JDK; done when the Maven test build no longer reports the mismatched-JDK warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, vscode
- Domain
- devtools, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100