maven 编译 java_通过Maven编译Java 7代码

詹夕
2023-12-01

我的pom文件列表

org.apache.maven.plugins

maven-compiler-plugin

3.0

org.apache.maven.plugins

maven-surefire-plugin

2.12.4

maven-compiler-plugin

1.7

1.7

...

然而mvn clean install,我得到

[INFO] -------------------------------------------------------------

[ERROR] COMPILATION ERROR :

[INFO] -------------------------------------------------------------

[ERROR] Failure executing javac, but could not parse the error:

javac: invalid target release: 1.7

Usage: javac

/usr/bin/java -version是(which java点在这里)

java version "1.7.0_10"

Java(TM) SE Runtime Environment (build 1.7.0_10-b18)

Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)

javac 也指向正确的Java版本

/usr/bin/javac -> /Library/Java/JavaVirtualMachines/jdk1.7.0_10.jdk/Contents/Home/bin/javac

在这台机器上,我正在使用zsh(echo $0return -zsh)

在我的中.zshrc,我定义了:

33 # HOME

34 JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_10.jdk/Contents/Home

35 SCALA_HOME=/Library/Scala/current

36 FORGE_HOME=~/tools/forge/

37

38 # PATH

39 PATH="/Library/Frameworks/Python.framework/Versions/3.2/bin:${PATH}"

40 PATH=${PATH}:${JAVA_HOME}/bin

41 PATH=${PATH}:/bin/

42 PATH=${PATH}:/sbin/

43 PATH=${PATH}:/usr/bin/

44 PATH=${PATH}:/usr/sbin/

45 PATH=${PATH}:/opt/local/bin/

46 PATH=${PATH}:/opt/local/sbin/

47 PATH=${PATH}:/usr/local/git/bin

48 PATH=${PATH}:/usr/local/git/sbin

49 PATH=${PATH}:/Applications/Xcode.app/Contents/Developer/usr/bin

50 PATH=${PATH}:${SCALA_HOME}/bin

51 PATH=${PATH}:${FORGE_HOME}/bin

52

53 export PATH

在运行时,mvn clean install --debug我发现实际上我在使用Java 6

1 Apache Maven 3.0.3 (r1075438; 2011-02-28 11:31:09-0600)

2 Maven home: /usr/share/maven

3 Java version: 1.6.0_35, vendor: Apple Inc.

4 Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

在哪里可以定义?我的.zshrc有多次source(d)。

 类似资料: