vscode-java-debug
vscode-java-debug copied to clipboard
Test build failure
Hello I have a java project with gradle build.
I want to build with Java 8. My code used packages removed in java 11, for example javax.xml.bind.JAXBContext
So , in my build.gradle, I have
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
And I can run gradle tasks build/check/test using the vscode gradle side bar item without issues.
But when I try to launch a test using Test runner, the gradle build fails with "error: package javax.xml.bind does not exist" So it seems to build with Java 11! So why? Does test runner uses another gradle version (where java sourceCompatibility/targetCompatibility is not supported)? Does a workaround exists? I checked also Command -> Configure java runtime , and I have Java 1.8 configured too.
Environment
- Operating System: VScode is running on Windows 10 with a remote-ssh to a Linux workstation
- JDK version: 1.8
- Visual Studio Code version: 1.85.2
- Java extension version: 0.25.15
@jdneo for a look.
Could you share a sample project?
@jdneo
See attached
SampleGradleProject.zip
I don't know if it is related but in my settings file, I have also
"java.import.gradle.wrapper.enabled": false,
"java.import.gradle.version": "7.6.3",
Hi @sebastieng,
Please try to set java.import.gradle.java.home to your jdk 8 installation path and reload your vscode.
Thanks @jdneo . I confirm , it fix my issue