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
The java builder should use the correct compiler compliance to build the project #1290
Comments
That causes Java LS to use the workspace Compiler Compliance level 13.
or use the following settings:
|
@snjeza Most of users don't have knowledge about the |
@testforstephen I agree. @fbricon What do you think? |
I had the same problem when not using the properties:
As I'm experimenting with Java 14 the way to configure the java version in maven has changed to:
Thus, from the point of view of maven, it is no longer necessary to use maven.compiler.target/source, however, for VS Code it is still necessary to specify these properties so that it correctly interprets the version of Java used in the project. Then, I solve my scenario using this two settings above. |
Well hello there :) It does seem that VSCode-Java stuggles to properly detect and apply maven compiler settings from maven's I've tried a number of configurations, and no matter what I do, the Java version defaults to 1.6 in This matter is made worse because the vscode-java plugin will overwrite manually configured settings back to 1.6 when updating project configurations, making this supremely disruptive. I also had to to set configurations manually in the
|
@lincolnthree could you attach your project or pom.xml? |
Update. Looks like adding a newer version of the
|
The broken version was |
Perhaps a warning could be issued if using an obsolete/incompatible version of the maven-compiler-plugin. |
I have the same problem on a project with mixed JDK 8 and JDK 11/17 for its module. e.g.: not enough <properties>
<maven.compiler.release>17</maven.compiler.release>
</properties> but this works: <properties>
<maven.compiler.release>17</maven.compiler.release>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties> I am using <build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
</plugin> |
Environment
Steps To Reproduce
.
Current Result:
See the screenshot above, the PROBLEMS viewlet reports a warning on the project: "The compiler compliance specified is 13 but a JRE 1.8 is used". This means the classfile built by the ls is targeting to java 13, that would make it not able to be launched in JDK 8.
Besides, the debugger has fixed a bug microsoft/vscode-java-debug#753 about using the project's Java runtime to launch the application. The latest debugger would fail at this case.
Expected
The language server should generate the compatible .class files with the project's Java Runtime.
// @fbricon @snjeza
The text was updated successfully, but these errors were encountered: