Dynamic Web Module 3.0 requires Java 1.6 or newer
2016-03-25 11:29
495 查看
百度说是因为JAVA编译器的版本太低,需要在preferences->java->compiler选择右边的Compiler compliance level:为1.6以上版本。但是我这已经是1.8了,不是这个问题。
接着又看到有说工程的.classpath文件里配置了J2SE-1.5,其实就是工程的buildpath-Libraries里的JRE System Library。我这也是1.8,还是没解决问题
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
继续找到第三种方案,打开项目的根目录找到.settings文件夹,修改里边的文件中设计版本号的地方,我这也都是1.8.。。。
继续找到第四种方案,说是Maven 3.0 source和target的默认设置都是1.5,与运行Maven时的JDK版本无关,除非在项目的POM文件中显示的指定一个版本,否则每次更新后都会使用编译器默认的source/target版本1.5。这个是正解,在pom.xml里加上这个终于好使了。
但这只是针对单独的项目配置,最终的方法是修改maven的settings.xml配置,将maven的默认设置改为1.8:
<profiles>
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
</profiles>
接着又看到有说工程的.classpath文件里配置了J2SE-1.5,其实就是工程的buildpath-Libraries里的JRE System Library。我这也是1.8,还是没解决问题
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
继续找到第三种方案,打开项目的根目录找到.settings文件夹,修改里边的文件中设计版本号的地方,我这也都是1.8.。。。
eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.source=1.8
继续找到第四种方案,说是Maven 3.0 source和target的默认设置都是1.5,与运行Maven时的JDK版本无关,除非在项目的POM文件中显示的指定一个版本,否则每次更新后都会使用编译器默认的source/target版本1.5。这个是正解,在pom.xml里加上这个终于好使了。
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin>
但这只是针对单独的项目配置,最终的方法是修改maven的settings.xml配置,将maven的默认设置改为1.8:
<profiles>
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
</profiles>
相关文章推荐
- UITextView详解
- LeetCode 225 Implement Stack using Queues
- CDuiString的bug
- 设计模式:建造者模式(Builder)
- 设计模式:建造者模式(Builder)
- 关于UICollectionViewCell的问题
- Java day09 StringBuffer与StringBuilder
- Interger声明的在-128 ~ 127之间值比较为true
- 关于button — 点击变换背景图片
- ${pageContext.request.contextPath}的作用
- X5的UI部分和传统Web页面开发的差异
- IOS开发UI篇--使用CAShapeLayer实现复杂的View的遮罩效果
- unigui中TUniDBEdit的OnEndDrag问题
- iOS UILabel设置行间距和字间距并计算高度
- iOS开发基础 - UINavigationcontroller
- iOS开发基础 - UISearchController
- iOS开发基础 - UITableView
- iOS开发基础 - UICollectionView
- iOS开发基础 - UITouch的使用
- iOS-为UITableViewCell添加详情指示图,和说明文字