java ee eclipse 配置 ssh框架

mvnDebug tomcat:run 這條命令主要用來遠程測試,它會監聽遠程測試用的8000端口,在eclipse裏打開遠程測試後,它就會跑起來了,設斷點,調試,一切都是這麼簡單。java

0、若是是maven項目,先利用mvn eclipse:eclipse 將maven項目轉換爲eclipse項目,而後導入eclipse;最好在eclipse裏安裝tomcat的plugin (也可不裝,不影響使用)。web

一、若是一個工程不能有錯誤,找不到javax.servlet.*之類的,在工程的proterty裏面選擇 targeted runtime。tomcat

二、若是部署到本地tomcat時出現"Loading descriptor for project has encountered a problem" 等錯誤:服務器

  Install: JST Server UI, JST Web UI, JST Server Adapters, JST Server Adapters Extension, WST Server Adapters.app

  (You may also need Eclipse Java EE Developer tools, Eclipse Java Web Developer tools, Java Server Faces tools or JSF tools, Eclipse faceted Project Framework and Eclipse faceted Project Framework JDT Enablement)eclipse

三、添加Server服務器時,選擇configure runtime enviroments 把服務器的 runtime enviroment所有刪除。添加成功後,選擇use tomcat installation。webapp

四、若在eclipse啓動的tomcat沒法進入localhost:8080頁面,則可能須要這樣修改:maven

 http://stackoverflow.com/questions/8520267/localhost8080-gives-404-the-requested-resource-is-not-availableide

Doubleclick the Tomcat server entry in the Servers tab, you'll get the server configuration. At the left column, under Server Locations, select Use Tomcat installation (note, when it is grayed out, read the section leading text! ;) ). This way Eclipse will take full control over Tomcat, this way you'll also be able to access the default Tomcat homepage with the Tomcat Manager when running from inside Eclipse. I only don't see how that's useful while developing using Eclipse.測試

eclipse中server location灰色,如何修改?

選擇window ----show view---services能夠看到服務的面板, 若要更改,先把tomcat下的全部項目移除。並右擊,clean...以後方可設置。。。啓動後將又變爲黑色。

4.一、    server options 的選項的意義:  通常狀況下勾選上 publish module contexts to separate XML files, 省得eclipse 修改了 tomcat 的 server.xml 文件。

接下來看看圖中幾個參數的含義:

 (1)serve modules without publishing:
讓tomcat直接使用WebContent下的東西
省去publish到<workspace>\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
勾上它會將tmp0\wtpwebapps下相關的resources刪除,
同時會修改Servers/Tomcat v6.0 Server at localhost-config/servers.xml中的serveModulesWithoutPublish=true
以及tmp0/conf/server.xml中的<Context>配置

(2)publish module contexts to separate XML files

勾選 上後會修改Servers/Tomcat v6.0 Server at localhost-config/servers.xml中的saveSeparateContextFiles=true

同時將tmp0/conf/server.xml中關於該app的<Context>元素

移動到tmp0/conf/Catalina/localhost/appName.xml中..

將用於開發的localhost當成實際應用的server的話(也就是使用開發的tomcat來發布應用),則必須將 conf/Catalina/localhost/appName.xml 刪除,否則發佈不會成功。

 

五、若是部署後出現http 404 什麼的狀況,能夠先考慮看看是不是deployment assembly的問題,即部署參數設置不對的問題。

http://josh-persistence.iteye.com/blog/1926808

可能的緣由主要有2個:

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代碼   收藏代碼
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <projectDescription>  
  3.     <name>shortbread</name>  
  4.     <comment></comment>  
  5.     <projects>  
  6.     </projects>  
  7.     <buildSpec>  
  8.         <buildCommand>  
  9.             <name>org.eclipse.jdt.core.javabuilder</name>  
  10.             <arguments>  
  11.             </arguments>  
  12.         </buildCommand>  
  13.         <buildCommand>  
  14.             <name>org.eclipse.wst.common.project.facet.core.builder</name>  
  15.             <arguments>  
  16.             </arguments>  
  17.         </buildCommand>  
  18.         <buildCommand>  
  19.             <name>com.google.gdt.eclipse.core.webAppProjectValidator</name>  
  20.             <arguments>  
  21.             </arguments>  
  22.         </buildCommand>  
  23.         <buildCommand>  
  24.             <name>com.google.gwt.eclipse.core.gwtProjectValidator</name>  
  25.             <arguments>  
  26.             </arguments>  
  27.         </buildCommand>  
  28.         <buildCommand>  
  29.             <name>org.eclipse.m2e.core.maven2Builder</name>  
  30.             <arguments>  
  31.             </arguments>  
  32.         </buildCommand>  
  33.     </buildSpec>  
  34.     <natures>  
  35.         <nature>org.eclipse.jdt.core.javanature</nature>  
  36.         <nature>org.eclipse.m2e.core.maven2Nature</nature>  
  37.         <nature>org.eclipse.wst.common.project.facet.core.nature</nature>  
  38.         <nature>com.google.gwt.eclipse.core.gwtNature</nature>  
  39.       <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>  
  40.     </natures>  
  41. </projectDescription>  

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

 

 

 

附:設置部署程序集(Web Deployment Assembly)

 

 

 

此處列表是,部署項目時,文件發佈的路徑。

1,咱們刪除test的兩項,由於test是測試使用,並不須要部署。

2,設置將Maven的jar包發佈到lib下。

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

設置完成效果圖


相關文章
相關標籤/搜索