How can I get IDEA to retain 'Ajc' as the project compiler?
Answered
When I select 'Ajc' as the project compiler and then hit Reload All Maven Projects, IntelliJ switches back to 'Javac' automatically. I think there is some way IDEA can autodetect that 'Ajc' is the correct choice but I don't know what the criteria for that are. I'm using the Maven plugin com.nickwongdev:aspectj-maven-plugin. I'd like the IDE to at least retain my setting of compiler whenever i have to update the project dependencies.
Please sign in to leave a comment.
IDE uses the Maven configuration for compiler when you have Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Maven | Importing | Detect compiler automatically option enabled.
Please make sure to use latest IDE versions as the com.nickwongdev:aspectj-maven-plugin support has been added in later versions: https://youtrack.jetbrains.com/issue/IDEA-230356
if problem remains can you provide a sample project that would show the Maven configuration you use?
Disabling "detect compiler automatically" works. Thanks! But the plugin didn't help, I have it configured as such:
Are you sure the aspectj compiler is effectively used for the project when you compile from command line?
Try explicitly specifying the compiler using compilerId configuration properly of maven-compiler-plugin. Since the default compiler is always javac. The aspectj value will set it to aspectj compiler.