vscode-maven icon indicating copy to clipboard operation
vscode-maven copied to clipboard

Intellisense uninformed about the change in Maven project's Java version

Open aderchox opened this issue 4 years ago • 3 comments
trafficstars

Describe the bug A clear and concise description of what the bug is. I edit the version string in pom.xml and compile the project successfully, but then still the intellisense is on the wrong version of Java.

To Reproduce Steps to reproduce the behavior:

  1. Start a project using quick-archetype.
  2. Add some code and compile.
  3. Change the Java version in pom.xml
  4. Error on a method reference: Method references are allowed only at source level 1.8 or above.

Expected behavior Since I have updated the Java version to 1.8, I expect not to see the Intellisense error.

Environments (please complete the following information as much as possible):

  • OS: [e.g. Windows 10/Linux/OS X] Windows 10
  • VS Code version: [e.g. 1.24.0] 1.60.2
  • Extension version [e.g. 0.9.0] 0.34.0

Screenshots If applicable, add screenshots to help explain your problem. image

aderchox avatar Oct 07 '21 01:10 aderchox

Changing the version in .settings/org.eclipse.jdt.core.prefs (as mentioned here as well) fixed my issue, but I'll keep this issue open since I think it's an unintuitive process.

aderchox avatar Oct 07 '21 02:10 aderchox

the intellisense is provided by vscode-java extension. AFAIK, after you change pom.xml, projects will be updated automatically. Please check if you have changed setting java.configuration.updateBuildConfiguration.

java.configuration.updateBuildConfiguration : Specifies how modifications on build files update the Java classpath/configuration. Supported values are disabled (nothing happens), interactive (asks about updating on every modification), automatic (updating is automatically triggered).

From: https://github.com/redhat-developer/vscode-java#supported-vs-code-settings

Eskibear avatar Oct 11 '21 02:10 Eskibear

No, I just checked and I had not changed that setting (now I will set it to automatic however, just in case the same thing occurs again, hopefully this will fix it. I think it must be their default though.) Anyway, thank you for your response.

aderchox avatar Oct 11 '21 06:10 aderchox