zoukankan      html  css  js  c++  java
  • 解决Dynamic Web Module 3.0 Requires Java 1.6 or newer

           ---本文为网络查找之后的个人总结,并非全部原创,希望能对大家有所帮助。

           ecliipse 默认的 JDK 版本为1.5,web版本为2.3,当我们需要web版本为3.0时,要在相应的配置文件中对web和JDK版本做对应的修改。我用的是 jdk 1.7

    一,修改配置文件

         直接打开项目的根目录找到.settings文件夹需要我们动手脚的文件是:

         1.org.eclipse.jdt.core.prefs

                1.5的全部改为1.7如下:

    eclipse.preferences.version=1
    org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
    org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
    org.eclipse.jdt.core.compiler.compliance=1.5
    org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
    org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
    org.eclipse.jdt.core.compiler.source=1.5


         2.org.eclipse.wst.common.component

              将下面的version=”1.5.0”改为version=”1.7.0”

    <?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
        <wb-module deploy-name="webtest">
            <wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
            <wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
            <property name="context-root" value="webtest"/>
            <property name="java-output-path" value="/webtest/build/classes"/>
        </wb-module>
    </project-modules>


         3.org.eclipse.wst.common.project.facet.core.xml

             将installed facet=”jst.web” version=”2.3”改为installed facet=”jst.web” version=”3.0”, installed facet=”java” version=”1.5”和  installed facet=”wst.jsdt.web” version=”1.5”中的1.5改成1.7

    <?xml version="1.0" encoding="UTF-8"?>
    <faceted-project>
      <fixed facet="wst.jsdt.web"/>
      <fixed facet="java"/>
      <fixed facet="jst.web"/>
      <installed facet="java" version="1.5"/>
      <installed facet="jst.web" version="2.3"/>
      <installed facet="wst.jsdt.web" version="1.5"/>
    </faceted-project>


    二,在eclipse中进行修改

        1,项目右击---properties

              要修改的地方如下显示:

     

                  --Java Build Path

     

        双击后,弹出编辑页面,选择SE-1.7---FINISH---apply

           -----Java Compiler

                    去勾选择,选中应用

           -----Project Facets

    点击OK即可

    2,windows---preferences---installed JREs

     

    三,修改pom.xml配置文件

    在<build></build>中插入如下配置

     <plugins>
                <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>
                    </configuration>
                </plugin>
            </plugins>

         然后保存,项目构建完成后在项目文件夹上点右键,选择Maven->Update Project Configuration,问题解决。或者项目右击--debug as--maven clean 然后maven--update project-勾选force update of snapshots/releases  问题解决。
        

  • 相关阅读:
    Python--初识函数
    Python中的文件操作
    Python中的集合
    Python中的编码和解码
    Python的关键字is和==
    Python中的字典
    Python中的列表和元组
    Python中几种数据的常用内置方法
    Python的编码
    python_while
  • 原文地址:https://www.cnblogs.com/kunsunshine/p/6293582.html
Copyright © 2011-2022 走看看