Cannot change version of project facet Dynamic web

來源:互聯網
上載者:User

標籤:

問題描述

        用Eclipse建立Maven結構的web項目的時候選擇了Artifact Id為maven-artchetype-webapp,由於這個catalog比較老,用的servlet還是2.3的,而一般現在都是用3.0,在Project Facets裡面修改Dynamic web module為3.0的時候就會出現Cannot change version of project facet Dynamic web module to 3.0,

其實在右邊可以看到改到3.0需要的條件以及有衝突的facets,4

解決這個問題的步驟如下: 1.把Servlet改成3.0,開啟項目的web.xml

<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns="http://java.sun.com/xml/ns/javaee"xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"id="schedule-console" version="3.0">
2.修改項目的設定,在Navigator下開啟項目.settings目錄下的org.eclipse.jdt.core.prefs

把1.5改成1.7

eclipse.preferences.version=1org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabledorg.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7org.eclipse.jdt.core.compiler.compliance=1.7org.eclipse.jdt.core.compiler.problem.assertIdentifier=errororg.eclipse.jdt.core.compiler.problem.enumIdentifier=errororg.eclipse.jdt.core.compiler.problem.forbiddenReference=warningorg.eclipse.jdt.core.compiler.source=1.7
3. 開啟org.eclipse.wst.common.component 

本檔案不用修改

<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">    <wb-module deploy-name="xband-schedule-console">        <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>        <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>        <dependent-module archiveName="xband-schedule-core-1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/xband-schedule-core/xband-schedule-core">            <dependency-type>uses</dependency-type>        </dependent-module>        <property name="java-output-path" value="/xband-schedule-console/target/classes"/>        <property name="context-root" value="schedule-console"/>    </wb-module></project-modules>
4. 開啟org.eclipse.wst.common.project.facet.core.xml  

把1.5改成1.7

<?xml version="1.0" encoding="UTF-8"?><faceted-project>  <fixed facet="wst.jsdt.web"/>  <installed facet="jst.web" version="3.0"/>  <installed facet="wst.jsdt.web" version="1.0"/>  <installed facet="java" version="1.7"/></faceted-project>
最後的效果

Cannot change version of project facet Dynamic web

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.