Without a dedicated IntelliJ plugin / integration this is not going to be possible, and I don't think this should be considered a bug in IntelliJ, because there is not a lot that IntelliJ can do here. The Hibernate bytecode enhancer and Lombok function very differently. The Hibernate bytecode enhancer takes already compiled classes and adds some instrumentation to it using, as of their latest version, Bytebuddy. This processing can be done either through a Maven / Gradle plugin, or on runtime, if you are in a J2EE environment. IntelliJ does not compile its sources through Maven and Gradle directly, AFAIK it parses the config and invokes the compiler by it self. Hence this will always bypass any post compilation plugins from the build tools. You can add the Maven goal to IntelliJs build process, but it will invoke a full Maven compilation too, which is tedious. The only reason why Lombok manages to work with the IntelliJ compiler is because they are an APT (Java Annotation Processing) plugin. These APT plugins are discovered from the classpath / build tool configuration and ran by the IntelliJ compiler as well. There however is a catch: APT is ment to be for generated source code generation, and not at all for replacing existing classes. The only reason why Lombok is still able to do so is because they hack their way very deep into the compiler and are by that means able to manipulate the AST of classes under compilation. Because this approach is largely controversial and error prone with future versions of Java, it is highly unlikely that anyone will ever even attempt at building a Hibernate APT enhancer plugin or an extension of Lombok that is able to do this (weren't it for the fact that Lombok is the only tool that could be considered a "framework" for this type of APT usage and Lombok itself is not at all build in an extendible manner). Admittedly, the extra turnaround time of compilation in order to just use bytecode enhancement is a big no go for me. I am in a large multi module project and having to do a full mvn compile just to get the enhanced classes won't do it for me, and unfortunately this has discouraged me to start using Bytecode instrumentation for now. I'm still looking for other options too, so if you have had any luck in setting up your IDE for compilation with bytecode enhancement I would be happy to hear about that. Personally I have been looking into alternative compilers with good IntelliJ support, such as the AspectJ compiler, to do the enhancement, but I haven't gotten anywhere with that yet. |