Maven in OSX Keeps Compiling with Java 1.5 -


i have code i'm working on 2 different location, win7 machine , osx.

when worked on using win7 machine, don't need bother java version maven compiles, need set path variable. if i'm on java 5, compiles against java 5, if i'm on java 7, compiles against java 7. no problem there.

different case osx machine. exact same set of codes.

my java version

[mac-pro] ~/apache-maven/apache-maven-3.1.1/conf $ p01ntbl4nk> java -version java version "1.7.0_60" java(tm) se runtime environment (build 1.7.0_60-b19) java hotspot(tm) 64-bit server vm (build 24.60-b09, mixed mode) 

my maven version

[mac-pro] ~/apache-maven/apache-maven-3.1.1/conf $ p01ntbl4nk> mvn -version apache maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 23:22:22+0800) maven home: /users/p01ntbl4nk/apache-maven/apache-maven-default java version: 1.7.0_60, vendor: oracle corporation java home: /library/java/javavirtualmachines/jdk1.7.0_60.jdk/contents/home/jre default locale: en_us, platform encoding: utf-8 os name: "mac os x", version: "10.9.1", arch: "x86_64", family: "mac" 

both shows same java version. java 7u60.

but when run mvn clean compile on codes, getting "try-with-resource not supported in -source1.5"

[error] failed execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project archival-client: compilation failure [error] /users/p01ntbl4nk/gitrepositories/genericarchival/root/archival-client/src/main/java/org/si/genericarchival/client/app.java:[140,6] error: try-with-resources not supported in -source 1.5 [error] -> [help 1] [error]  

i've checked, don't have reference in main maven settings.xml or in of pom.xml in modules indicate use sourve version 1.5

to fix this, have add following pom.xml

<plugin>     <artifactid>maven-compiler-plugin</artifactid>     <version>3.1</version>     <configuration>         <source>1.7</source>         <target>1.7</target>     </configuration> </plugin> 

but mean maven modules no longer adaptable java version of underlying platform.

am missing anything?

well, have answer, here definitively. http://maven.apache.org/plugins/maven-compiler-plugin/

also note @ present default source setting 1.5 , default target setting 1.5, independently of jdk run maven with. if want change these defaults, should set source , target described in setting -source , -target of java compiler.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -