Hi, When I try to compile a project with Maven I get the following error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project webserverlog: Compilation failure [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? [ERROR] -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project webserverlog: Compilation failure No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? When I specify the source and target versions as 1.7 in the pom.xml Maven throws a different error: javac: invalid flag: -s. Maven info: $ mvn --version Apache Maven 3.0.4 (r1232337; 2012-01-17 18:44:56+1000) Maven home: /Users/jerry/dev/springsource/apache-maven-3.0.4 Java version: 1.7.0_25, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "10.8.4", arch: "x86_64", family: "mac" When I run "$ echo $JAVA_HOME" I get /Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home. And when I run $ $JAVA_HOME/bin/javac -version I get javac 1.7.0_25 javac: no source files Usage: javac <options> <source files>. /Library/Java/JavaVirtualMachines/CurrentJDK -> /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk via symlink. Compiling project using Maven and the compiler plugin worked fine on the JDK 1.6 version from Apple. I'm trying to compile the Java EE 7 examples from Glassfish 4, so need the JDK 7 to work. Does anyone else have the same problem? Any suggestions on how to fix this? Thanks, Jerry
