Classes compile outside vscode in CLI, but in vs-code problem section displays errors and editor highlights code lines in red
See original GitHub issueJava Code is compiling neatly, outside the Vs-Code IDE i.e., from command line and other IDE’s like IntelliJ, but when I import my project into VS-Code there are some errors displayed in problems section. Some of them are shown here with screenshots
Environment
- Operating System: Windows 10
- JDK version: 1.8 - J9 VM
- Visual Studio Code version: 1.47.2
- Java extension version: v0.64
- Build tool: Gradle, wrapper version, 4.8.1
Steps To Reproduce the
- Create a project having src/main/resources and add your java code directly inside src\main
Java Model Exception: Java Model Status [Cannot nest '<project>/src/main/resources' inside '<project>/src/main'. To enable the nesting exclude 'resources/' from 'junit_tests/src/main']
Current Result
-
Below is the Java language server log file excerpt
-
I have tried excluding the resources folder, but no luck, problems section still has this.
-
All these compile times issues or problems shown in the problems section in vsc-code are not detected in IntelliJ IDE. Not sure why the is is happening.
-
The code/java intellisense cannot trace the relationship between so, red marks with lines highlighted is shown, but actually that’s not the case, as the classes are compiled perfectly from command line.
-
Some of the compiler issues, shown in the problems section are -
-
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (5 by maintainers)
@dragozir Could you try replace
with
or remove this line. You should install the java-14-openjdk-src package.
I have similar issue in tests as well. It shows:
However, it compiles fine from command line and IntelliJ.
Here’s a piece of code:
Here’s a bit of info about my vscode