How to configure Maven in IntelliJ to use JDK 7 on OS X?


This is with 11.1.1 (build IU-117.117).

I have JDK 1.7.0_04 (official release) installed on OS X Lion (10.7.3). JAVA_HOME is being set correctly, in my .bashrc, to /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home. I have configured JDK 7 for my project and can build via the IDE, but not via Maven - Maven appears to be trying to use a 1.6-version javac, and doesn't recognize target 1.7.

However, Maven run from the command line works (appears to be picking up JAVA_HOME).

I've been searching around but can't find out how to force Maven to use JDK 1.7 from within IDEA.

Is this possible/supported?



File > Settings > Project Settings > Maven > Runner.  There's a pull down for what JRE to use. One of those options should be JAVA_HOME or you can pick any of your configured JDKs.  There's an enhancement to be able to use the project JDK but that won't be available until 12.