Eclipse中Project的屬性Deployment Assembly(部署程式集)消失了,不存在了,去哪兒了

來源:互聯網
上載者:User

1. 該項目不是web項目,所以不存在Deployment Assembly 屬性。在Eclipse中,怎樣將一個非web project變成一個web project。

  1)右鍵項目,選擇Project Facets,點擊Convert to faceted from


  2) 配置Project Facets

 

更改Dynamic Web Module的Version為2.5。(3.0為Java7的)。

如果提示錯誤,可能需要在Java Compiler設定Compiler compliance level 為1.6。或者需要在此視窗的Java的Version改成1.6。


 

  3) 配置 Modify Faceted Project

點擊Further configuration available…,彈出Modify Faceted Project視窗

此處是設定web.xml檔案的路徑,我們輸入src/main/webapp。

Generate web.xml deployment descriptor自動產生web.xml檔案,可選可不選。

 

2. 經過1的project轉換後,應該能夠看到Deployment Assembly出現了,但如果還麼出現,很有可能在Eclipse中Deployment Assembly被disable了,那麼我們需要做的就是將Deployment Assembly選項enable。

在項目所在的工作區間有一個.project檔案,開啟該檔案增加如下這一行用於enable Deployment Assembly屬性。

<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>

如下面的.project file. Xml代碼    <?xml version="1.0" encoding="UTF-8"?>   <projectDescription>       <name>shortbread</name>       <comment></comment>       <projects>       </projects>       <buildSpec>           <buildCommand>               <name>org.eclipse.jdt.core.javabuilder</name>               <arguments>               </arguments>           </buildCommand>           <buildCommand>               <name>org.eclipse.wst.common.project.facet.core.builder</name>               <arguments>               </arguments>           </buildCommand>           <buildCommand>               <name>com.google.gdt.eclipse.core.webAppProjectValidator</name>               <arguments>               </arguments>           </buildCommand>           <buildCommand>               <name>com.google.gwt.eclipse.core.gwtProjectValidator</name>               <arguments>               </arguments>           </buildCommand>           <buildCommand>               <name>org.eclipse.m2e.core.maven2Builder</name>               <arguments>               </arguments>           </buildCommand>       </buildSpec>       <natures>           <nature>org.eclipse.jdt.core.javanature</nature>           <nature>org.eclipse.m2e.core.maven2Nature</nature>           <nature>org.eclipse.wst.common.project.facet.core.nature</nature>           <nature>com.google.gwt.eclipse.core.gwtNature</nature>         <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>       </natures>   </projectDescription>  

 然後重啟Eclipse, 就可在Project的properties中看到Deployment Assembly選項了。

 

 

  附:設定部署程式集(Web Deployment Assembly)

 

 

 

此處列表是,部署項目時,檔案發布的路徑。

1,我們刪除test的兩項,因為test是測試使用,並不需要部署。

2,設定將Maven的jar包發布到lib下。

Add -> Java Build Path Entries -> Maven Dependencies -> Finish

設定完成效果圖


 

 

聯繫我們

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