Eclipse 匯入外部項目無法識別為web項目並且無法在部署到tomcat下

來源:互聯網
上載者:User

1、進入項目目錄,找到.project檔案,開啟。

2、找到<natures>...</natures>程式碼片段,加入如下標籤內容並儲存:

<nature>org.eclipse.jem.workbench.JavaEMFNature</nature> 
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature><nature>org.eclipse.jdt.core.javanature</nature><nature>org.eclipse.wst.jsdt.core.jsNature</nature>

3、刪除.setting下的檔案,從其它Eclipse  web項目(如果沒有的話用eclipse建立一個)的.setting檔案下拷貝以下檔案

.jsdtscopeorg.eclipse.jst.common.project.facet.core.prefsorg.eclipse.wst.common.componentorg.eclipse.wst.common.project.facet.core.xmlorg.eclipse.wst.jsdt.ui.superType.containerorg.eclipse.wst.jsdt.ui.superType.name

4.修改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="springweb">        <wb-resource deploy-path="/" source-path="/WebRoot" tag="defaultRootSource"/>        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>        <property name="context-root" value="springweb"/>        <property name="java-output-path" value="/springweb1/build/classes"/>    </wb-module></project-modules>

將上面 所以 deploy-name值相同的地方改為你的項目名,同時把source-path 改為/WebRoot(如果你的項目目錄是WebContent就不用改了)

 

然後是.jsdtscope檔案:

<?xml version="1.0" encoding="UTF-8"?><classpath>    <classpathentry kind="src" path="WebRoot"/>    <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>    <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">        <attributes>            <attribute name="hide" value="true"/>        </attributes>    </classpathentry>    <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>    <classpathentry kind="output" path=""/></classpath>

把 <classpathentry kind="src" path="WebRoot"/> 中path改為/WebRoot(如果你的項目目錄是WebContent就不用改了)

5、在eclipse的項目上點右鍵,重新整理項目,就會發現項目變成了web項目,然後添加到tomcat中就會發現tomcat可以識別我們的項目了。

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.