Intellij 8.1.3 maven runner refuses to use java 1.5 instead of 1.6


I'm a fairly new intellij user, having switched from Eclipse because of the dreadful maven support.  And so far, I'm very pleased.  However, I'm having one small issue and I hope someone knows the solution.  When I run my maven projects from within intellij, using the maven menu, it refuses to run them with java 1.5, even though, I have set the maven runner to use 1.5 in the ide settings.  Within the maven runner window, it clearly shows that it's invoking maven with 1.6.  Unfortunately, I can't use 1.6 yet as there are still some pesky classes that will break if I do.  So does anyone know how to really force idea's maven runner to use 1.5?

Here's what I see in my invocation window:

/usr/lib/jvm/java-6-sun- -Dclassworlds.conf=/opt/maven-2.1.0/bin/m2.conf -Dmaven.home=/opt/maven-2.1.0 -Didea.launcher.port=7532 -Didea.launcher.bin.path=/opt/idea-9886/bin -Dfile.encoding=UTF-8 -classpath /opt/maven-2.1.0/boot/classworlds-1.1.jar:/opt/idea-9886/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher --no-plugin-registry --errors --fail-fast --no-plugin-updates --strict-checksums -s /opt/maven-2.1.0/conf/settings.xml -f /home/me/mystuff/myproject/pom.xml install

Comment actions Permalink

Hello Belinda,

Welcome to the IDEA community. And welcome to developing with pleasure.

Are you sure you are changing the maven runner for your project and not the template runner? Open the settings via File --> Settings or by using ctrl+alt+S. You can also get there from the Maven Tool Window by clicking on the "Maven Setings" button (the one with the smaller wrench and the paper behind it). Again, make sure it is the "Maven Settings" and not the "Template Maven Settings" button.

Once in the project settings dialog, under Project Settings | Maven | Runner change the JRE setting on the right.   Obviously you need to have a 1.5 JDK defined. If you don't you will need to define one by going to File --> Project Structure (or you can do it in the Template Project Structure settings by going to File --> Template Project Structure) and under Platform Settings | JDKs create a new JDK. If you still are not seeing the 1.5 when running, do a sanity check and make sure the 1.5 JDK you defined is truly pointing to a 1.5 install.

I just tried switching between a 1.5 and a 1.6 JDK for the runner in 8.1.3 and it worked fine.

If you make the change in the Template Settings screen [File --> Template Settings or using the "Template Maven Settings" button in the Maven tool window] that only affects what gets set by default when a new project is created.

By the way, if you like what IDEA's maven integration does in v8, wait until you try version 9 (currently in pre-release and due out this month). Maven support is been polished even further in it.

Hope that helps.

Comment actions Permalink

Thank you so much!  That was it.  I was editing the wrong thing.  It's working beautifully now, which is more than I can say for Eclipse.  (I recently switched from Eclipse because of the terrible maven support.)  If I can find time, I wll check out the new Maia build.


Please sign in to leave a comment.