When running our Maven build, a member of my team gets a NoSuchMethodError in one of the dependant plug-ins when executing. However, when we run java -version
from her command line, it indicates Java 1.6.0_26. The error obviously seems to be screaming that Maven is using Java 5.
How do I figure out and change what version of Java is being used by Maven?
3 potentially important notes:
- This is executed at the command line, not using Eclipse plugin
- JAVA_HOME is set to a Java 1.6 JDK
- Using Maven 2.2.1
Advertisement
Answer
mvn -version
will output which java it’s using. If JAVA_HOME is set to a valid JDK directory and Maven is using something else, then most likely someone has tampered with the way that Maven starts up.