Loading Annotation Processor with Enable Preview
已回答
Hello,
I'm trying to use JDK 14 with the record builder. When I try to build the project, I get the following message:
Error:java: Could not load processor class file due to 'Preview features are not enabled for io/soabase/recordbuilder/processor/RecordBuilderProcessor (class file version 58.65535). Try running with '--enable-preview''.
My project is imported as a Gradle project. When I run build and tests with the CMD, everything works as expected. Moreover, when I set up:
Preferences -> Build, Execution, Deployment -> Build Tools -> Gradle -> Build and run using: Gradle
it also worked. However, this solution is not suitable for me. I would like IJ to run all the builds when working with IDE.
How can I mark that I would like to load the annotation processor with the --enable-preview flag?
I have tried:
- Help -> Custom VM Options
- Preferences -> Compiler -> Annotation Processors -> Annotation processor options
- Setting language level in modules
- Setting the
--enable-previewflag in Gradle
请先登录再写评论。
Could not reproduce that for Gradle project in IntelliJ IDEA 2020.1.1.
What is your IntelliJ IDEA version?
Have you accepted the preview features alert when changed language level https://i.imgur.com/qljXAUF.png?
Don't you see the notification in the event log https://i.imgur.com/NZbhDAk.png?
I use
I don't see any of the notifications that you showed.
UPDATE:
In the workspace.xml I found the following line:
I changed its value to false and in the Event Log I can see:
Try to set 14(Preview) language level in project's settings:
https://i.imgur.com/GxcoyLv.png
It is done already. This was the very first thing that I did.
could you please share the project you are working on or create a minimal reproducible example?
Ok, I have created a reproducible example. On my machine, building the project with the hammer icon fails with the following message:
I didn't see any of the notifications related to experimental features when I was importing the sources.
Project build fine in my case: https://i.imgur.com/kgomNws.png
Try removing `.idea` folder in the project's root and re-import the project from build.gradle file.
Did you change
?
By default, Gradle is selected.
I created the project with spring.start.io and then imported it with Project from existing sources.
Yes, of course: https://i.imgur.com/N675wS8.png
Try restore default settings (File | Manage IDE Settings | Restore Default Settings) and disable custom plugins
After restoring to default settings, all the custom plugins have been erased.
Looks like it hasn't helped - https://imgur.com/a/dF1iuRw