0

Update: see the self-answer. The issue seems to be with Maven import or some sort of corruption of a module's settings after the import.

I have a very large multi-module Maven IntelliJ project with 3 separate roots.

I am building the whole project in preparation to commit.

I am getting the following error from IntelliJ 2017.2.3 Ultimate:

Information:Eclipse compiler 4.6.2 was used to compile java sources
...
Error:java: Target level '1.5' is incompatible with source level '1.8'. A target level '1.8' or better is required

None of the code is supposed to compile with Java 5, it's all Java 8.

The project is configured with JDK 1.8 Maven's maven-compiler-plugin is already configured to use version 1.8 of Java as explained here.

2 questions:

  • What causes this? Is it a known bug with IntelliJ?
  • How do I find out which module of the 100 or so modules in the project is the one causing the issue?
  • The answer to your question can be found [here](https://stackoverflow.com/questions/29888592/errorjava-javactask-source-release-8-requires-target-release-1-8) Cheers – Malakai Oct 04 '17 at 16:32
  • 3
    Possible duplicate of [Error:java: javacTask: source release 8 requires target release 1.8](https://stackoverflow.com/questions/29888592/errorjava-javactask-source-release-8-requires-target-release-1-8) – Basil Bourque Oct 04 '17 at 16:33
  • @BasilBourque The Maven's pom and the JDK in intelliJ are already configured as explained in the duplicate you found. –  Oct 04 '17 at 16:37
  • Have you executed the Maven Lifecycle items `clean` and `install` on the parent module? – Basil Bourque Oct 04 '17 at 16:41
  • @BasilBourque not sure how that would help with IntelliJ build process, but I'll try, thank you. –  Oct 04 '17 at 16:42
  • Your message from IntelliJ about the Eclipse compiler is suspect as IntelliJ does not use the Eclipse compiler. I assume this means you imported this project from Eclipse and there are some leftovers being encountered. Perhaps the Maven clean and install will flush those out. I also suspect you have not verified *all* of the settings as advised. IntelliJ tucks them away annoyingly in so nooks and crannies. And read comments to learn how POM can cause IntelliJ to revert those settings. – Basil Bourque Oct 04 '17 at 16:45
  • @BasilBourque, no, this is a brand new project from the sources. I selected "Eclipse compiler" in Settings because it allows me to continue the compilation even if errors are encountered. Thus, when the other project members sometimes screw up an unrelated area of the code, I can still work. –  Oct 04 '17 at 16:47
  • @BasilBourque "I am not as green as I am cabbage-looking" :) –  Oct 04 '17 at 17:33
  • If the project is built from command line Maven but still fails in IDEA after the import from Maven, please file an issue at https://youtrack.jetbrains.com/issues/IDEA with the example of Maven configuration for corresponding modules (parent/child including the one that fails to compile). For the second question, pease vote for https://youtrack.jetbrains.com/issue/IDEA-124643 – Andrey Oct 05 '17 at 03:51
  • @Andrey - I added my input to IDEA-124643, thank you. As to reporting the problem - the project is too complicated and proprietary to isolate a sample, and the issue sometimes just disappears. –  Oct 05 '17 at 13:03

1 Answers1

1

I was getting this for a few maven modules in my project, I could get rid of this by updating the .iml files under those modules by changing the following entry to 1.8-

 <orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" /
User2709
  • 573
  • 5
  • 17