If you are an IntelliJ IDEA user and you are using Maven in your project, chances are you may some day run into this incredibly cryptic and confusing message:
Error: javac: source release 1.6 requires target release 1.6
Googling it digs up a few approaches to solving the problem as well as some IntelliJ IDEA bug reports where people describe needing to re-create their projects to get rid of it.
Fortunately for me, the fix was exactly what was outlined by Daniel Höpfl here. Daniel pointed out that in his install of IntelliJ IDEA, under the File > Settings > Compiler > Java Compiler preference screen, for some reason “-target 1.4” had been set as an additional compiler parameter. Turns out, that is exactly what happened to me too:
All I had to do was remove that bogus setting and everything worked again.
The odd thing is that I’ve never messed with these settings before, the one thing I did do was configure the “maven-compiler-plugin” Maven plugin as well as the “maven-dependency-plugin” for my project — it is possible there is a synchronization bug in IntelliJ that causes that value to populate when trying to parse those settings from your project’s pom.xml, but that is just a guess.
Happy coding!



Thank you! A very succinct and clear explanation that had me back up and running in no time. You just saved me a lot of frustration I’m sure as like you say, this error message is pretty vague.
GH, glad I could help. I was at wits end when I hit this, so I knew I had to blog it incase anyone else hit it
Thank you for help
Alima, you are most welcome. Hope it helped save you some stress
Good call. I’ve just come across this as well and thanks to your article had it resolved in a jiffy. Thanks!
Did any of you set this -source argument or are all of you finding it magically inside your IJ setups and needing to clear it?
I’m wondering if there is a bug in IJ that I need to report, just want to figure out the commonality before submitting.
It just happened magically for me. I certainly would not have set target=1.5 manually – I don’t use it anymore for one thing.
Gary, did you set custom compiler plugins values for Maven in your POM? That is what I did before this problem popped up. When just working with plain Maven and dependencies, I never noticed it. As soon as I started messing with how the packaging was done (to include my dependent JARs) this issue arose.
Yeah, I always feel the need to specifically state which version of Java I’m targeting in the POM. Along with pretty much everything else. So it would appear that Intellij has picked up the Maven settings and configured itself against them but has not remained in synch.
Really appreciate your help. Extremely useful post.
Thanks,
I ran into this same issue today and this fixed it perfectly!
Thanks! This saved me at least a day of digging around in settings.
You’re the man, you just made my day
I was struggling with this stupid error message for hours now. THANKS A LOT.
Really glad this helped you guys!
Thanks for the post. You made my day! I came across the problem when I used maven with the settiing:
org.apache.maven.plugins
maven-compiler-plugin
1.6
1.6
where I previously had used 1.5: Intellij had “-target 1.5″ in the settings, which I had not set…
Thank you for this post – I just compiled apache-tika with maven2 on IntelliJ-Idea-10 and suddenly I found this strange error message.
Ingo, glad I could help!
Thank you so much – saved me hours of pain!
Thanks buddy… this solved the problem.
Thank you – this article was very helpful!!!!
Yes helped me too – and no, I didn’t set this property myself, was automagic as you point out. Thanks!
Most welcome Ben, glad it helped.
Thanks a lot man! You saved me lots of time hunting this nasty little bug down…
Great blog!
Glad to hear it, this one had me stumped when I ran into it.
Thanks for this. Within seconds have got further.
Bless you and all generations of your offspring forever!
I would have spent countless hours locating this crazy bug!
Thanks a lot! This was probably the fastest I ever got an actual answer while Googling an error message!
Aleksey, really glad I could help. That is exactly how I wanted people to find this (and not have to tear all their hair out). Happy coding!
Fantastic! This was the final, missing step in order for me to get Idea working on Ubuntu using Open JDK. The first of which was installing JDK 7, as it wouldn’t work with v6 for what ever reason.
Thanks again!
Most welcome Sam, glad to hear you got everything configured and working.
thx for the tip! A quick and clear response.
One day I was compiling ok, and the next that error showed up. But no one had touched my IDEA settings. Could it had loaded that info from some change in a pom.xml?
You are the man! … This saved my day.
Thanks.
Josh
Yay, cool…. thanks for posting this. Weird and extremely unuseful error message indeed