java - Maven: Fatal error compiling: invalid target release: 1.8 -


we upgraded project jdk 1.6 jdk 1.8. while building project in machine, i'm getting following error.

[error] failed execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project exception: fatal error compiling: invalid target release: 1.8 -> [help 1]

here maven compiler plugin been used

 <plugin>     <groupid>org.apache.maven.plugins</groupid>     <artifactid>maven-compiler-plugin</artifactid>     <version>3.3</version>     <configuration>         <source>1.8</source>         <target>1.8</target>         </configuration>   </plugin> 

i looked @ many post , of them related not having correct version configured java_home. verified of these aspects , couldn't find of them alarming.

java version -

 qadeersmsiphone:main pdubey$ java -version  java version "1.8.0_51"  java(tm) se runtime environment (build 1.8.0_51-b16)  java hotspot(tm) 64-bit server vm (build 25.51-b03, mixed mode) 

maven version -

qadeersmsiphone:main pdubey$ mvn -version apache maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 08:22:22-0700) maven home: /usr/share/maven java version: 1.8.0_51, vendor: oracle corporation java home: /library/java/javavirtualmachines/jdk1.8.0_51.jdk/contents/home/jre default locale: en_us, platform encoding: utf-8 os name: "mac os x", version: "10.8.5", arch: "x86_64", family: "mac" 

and checked while building project maven uses jdk 1.8

qadeersmsiphone:main pdubey$ mvn install -debug apache maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 08:22:22-0700) maven home: /usr/share/maven java version: 1.8.0_51, vendor: oracle corporation java home: /library/java/javavirtualmachines/jdk1.8.0_51.jdk/contents/home/jre default locale: en_us, platform encoding: utf-8 os name: "mac os x", version: "10.8.5", arch: "x86_64", family: "mac" [info] error stacktraces turned on. [debug] reading global settings /usr/share/maven/conf/settings.xml [debug] reading user settings /users/pdubey/.m2/settings.xml [debug] using local repository @ /users/pdubey/.m2/repository [debug] using manager enhancedlocalrepositorymanager priority 10.0  /users/pdubey/.m2/repository [info] scanning projects... 

update: working removing maven-compiler-plugin in pom file (ideally, don't want this). , observed if remove plugin, maven default downloads 3.3 version of compiler plugin in local repo. i'm not sure what's wrong in plugin although source , target appears correct.

check java , javac version - java version 1.8.0_51

$ java -version java version "1.8.0_51" 

but javac version pointing old jdk 1.7.0_67

$ javac -version javac 1.7.0_67 

there couple of thing should try -

  1. ensure symbolic link pointing correct jdk. if not, remove existing link , create new 1 jdk

    cd /system/library/frameworks/javavm.framework/versions/ rm currentjdk ln -s /library/java/javavirtualmachines/<jdk version>.jdk/contents/ currentjdk 
  2. in /library/java/extension, had tools.jar. believe, old jdk.

    cd /library/java/extensions -rw-r--r--  1 root  admin  15286304 jan 14  2015 tools.jar 

    remove this

    sudo rm -rf /library/java/extensions 

point 2 did trick me :)


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -