java se 1.6,Eclipse + Maven:强制执行环境“JavaSE-1.6”而不是固定的JDK

I'm using Eclipse as IDE and Maven outside of it to keep all dependencies up to date and update the Eclipse-project as such. In Eclipse I usually specify the JRE system library as an execution environment for any Java-project, usually "JavaSE-1.6".

In the pom.xml I use the following lines:

maven-compiler-plugin

2.3.2

1.6

1.6

maven-eclipse-plugin

2.8

[groupId].[artifactId]

true

2.0

This seems to let Maven pick a JDK matching 1.6. It assigns its system libraries to the classpath of the project. However, it uses jdk1.6.20 directly rather than JavaSE-1.6.

Is there a way to make Maven use JavaSE-1.6 instead?

EDIT:

Here's the batch file that I use to run Maven:

SET JAVA_HOME=C:\Programme\java\jdk1.6.0_20

SET MAVEN_HOME=C:\Programme\apache-maven-2.2.1

SET MAVEN_OPTS=-Xmx512m -XX:MaxPermSize=128m

SET PATH=%JAVA_HOME%\bin;%MAVEN_HOME%\bin;%PATH%

SET EXTRA_MVN_OPTS=-Dmaven.test.skip=true

CD /D "%~dp0"

cmd /c mvn %EXTRA_MVN_OPTS% eclipse:clean eclipse:eclipse

cmd /c mvn %EXTRA_MVN_OPTS% clean install

解决方案

You can do it by setting a classpath container.

org.apache.maven.plugins

maven-eclipse-plugin

2.8

org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6

Reference:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值