Different compilers (javac, eclipse) in a multi-module project

Answered

Hello,

I have a large project with multiple modules using maven. Some of the modules need to be compiled with the Eclipse compiler, and some with the default Javac. In the maven poms I can change the specific compiler, but I didn't find a way to switch the compile on a per-module basis for the IDEA build.

Is there some way to switch the compiler per module or isn't it possible in IDEA?

Thanks in advance and kind regards,

Marc 

0
1 comment

There is no such possibility to define eclipse and java compiler for different modules in on single project.

You can delegate build to maven by enabling the Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Maven | Runner | Delegate IDE build/run actions to Maven option.

Another option that might work is to make sure the Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Maven | Importing | Detect compiler automatically is disabled. Then set Eclipse compiler in IDE settings for the project, add to ignore list modules you want to compile by Jaca compiler (Settings (Preferences on macOS) | Build, Execution, Deployment | Compiler | Excludes | Build, Execution, Deployment | Compiler | Excludes) and setup Ant or Maven goals to compile needed modules. You can bind Maven/Ant goals to IDE build action, see

https://www.jetbrains.com/help/idea/configuring-triggers-for-ant-build-target.html#643eb

https://www.jetbrains.com/help/idea/work-with-maven-goals.html#trigger_goal

0

Please sign in to leave a comment.