Home > Enterprise >  IntelliJ - maven jvm.config file listing error "<operation> expected", but otherwise
IntelliJ - maven jvm.config file listing error "<operation> expected", but otherwise

Time:09-22

hopefully this question is appropriate for StackOverFlow

While upgrading a project to java 17, we discovered that we'd need to add a .mvn/jvm.config file for maven with the following line:

--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED

This solution works great for us (for now), and the project passes all tests using java 17 now. However, IntelliJ highlights "jdk.compiler/com.sun.tools.javac.api" with the following error:

<operation> expected, got 'j' :1

It seems to me that IntelliJ is seeing that this is a config file and expects it to follow some different rules than maven's jvm.config follow. According to this , jvm.config is supported by IntelliJ. Is there some setting in IntelliJ I can change to stop it from seeing this as an error, or at least ignore it for now? Or is this unavoidable for now? Thanks!

CodePudding user response:

If the .mvn/jvm.config exists in the project, IDE will use it and override the Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Maven | Importing | VM options for importer options (if defined).

The parsing error is most likely reported by some 3rd plugin for the .config files. It will not influence the IDE Maven import behaviour. Check if you have custom plugins installed and try disabling them.

  • Related