我正试图在新安装的最新netbeans上构建一个现有的maven项目,但遇到了以下错误,非常感谢您的帮助:
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project com.rory.ngp.test: Compilation failure
Failure executing javac, but could not parse the error:
javac: invalid target release: 1.7
我认为这与路径有关,但不太确定。这是我的/usr/lib/jvm directory;
的内容
bash-4.1$ pwd
/usr/lib/jvm
bash-4.1$ ls
java java-openjdk jre-1.6.0-openjdk.x86_64
java-1.5.0-gcj-1.5.0.0 jre jre-gcj
java-1.6.0 jre-1.5.0 jre-openjdk
java-1.6.0-openjdk-1.6.0.0.x86_64 jre-1.5.0-gcj
java-1.6.0-openjdk.x86_64 jre-1.6.0
谢谢各位,你们说得对。
我需要安装JDK1.7/Java 7,然后编辑netbeans安装目录/etc/netbeans.coff中的netbeans配置文件,以指向我安装新版本Java:的位置
# Default location of JDK, can be overridden by using --jdkhome <dir>:
netbeans_jdkhome="/users/rory/Documents/jdk1.7.0_02"
将以下内容添加到您正在构建的pom和插件中,它应该针对1.6
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
如果项目属性中的平台或源/二进制格式与此配置不相同,则会出现错误