0

I'm having this error when i try to install a project using maven. I read a lot of posts saying that this error is because maven is using another version of java but this is not my case (i think) because every command i run says that the version used is java 1.7.

This is the results of the terminal:

Maven installation error:
Failure executing javac, but could not parse the error:
javac: invalid target release: 1.7
Usage: javac <options> <source files>
use -help for a list of possible options

Output of mvn -version

Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 12:22:22-0300)
Maven home: /Applications/Dev/apache-maven-3.3.3
Java version: 1.7.0_79, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.11.1", arch: "x86_64", family: "mac"

Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home

pom.xml (compiler plugin section):

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>

Everything looks fine to me but keep getting the error.

Phoenix_uy
  • 3,173
  • 9
  • 53
  • 100

1 Answers1

2

Update maven-compiler-plugin version to 3.3:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.3</version> <!--  HERE  -->
    <configuration>
        <source>1.7</source>
        <target>1.7</target>
    </configuration>
</plugin>

How is the JAVA_HOME set?

Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre

Look like you need to correct this to /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/

Why I am not able to see the JAVA_HOME path on my MAC OS X 10.11?

Community
  • 1
  • 1
Verhagen
  • 3,885
  • 26
  • 36
  • That doesn't solve the problem... keep showing the same error – Phoenix_uy Nov 03 '15 at 13:10
  • JAVA_HOME throws `/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home` but in `mvn -version` throws `/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre` is the JAVA_HOME the first or the second? – Phoenix_uy Nov 03 '15 at 13:16
  • Check update in answer. I guess you are on OS-X v10.11 – Verhagen Nov 03 '15 at 13:20