tomcat源碼匯入eclipse

來源:互聯網
上載者:User

標籤:style   blog   http   io   os   ar   java   strong   檔案   

1. 擷取原始碼

   方式一:從官網http://tomcat.apache.org/download-70.cgi 直接下載,官網提供了Binary 和 Source Code兩種下載方式,要研究tomcat原始碼,選擇最下面的source code 方式下載

   方式二:利用svn擷取原始碼,先安裝svn,再建立目錄tomcat7, 接著在目錄裡用 svn執行以下命令  

  svn co http://svn.apache.org/repos/asf/tomcat/tc7.0.x/tags/TOMCAT_7_0_35/ ./   下載源碼

2. 將源碼匯入eclipse

  源碼下載下來以後,請參考 tomcat官網 http://tomcat.apache.org/tomcat-7.0-doc/building.html 中詳細的源碼匯入步驟,這是最好的文檔。

    tomcat的源碼是利用ant來建立和管理的。先安裝ant,再執行ant ide-eclipse,該命令執行成功後,會在tomcat7目錄下生產.project和.classpath兩個檔案,即成為eclipse工程了。這樣你就可以將tomcat源碼匯入eclipse了(通過General--》Exisiting Projects into Workspace 選擇ant 編譯好的tomcat源碼就可)   tomcat源碼匯入 eclipse 以後可能會遇到 jdk版本或jar包(junit 等jar包)問題(按照官網匯入,一般不會缺少jar包),自行解決jdk版本衝突後   匯入成功後如有問題 可以把examples 檔案夾刪除 3. 啟動tomcat  運行tomcat:找到tomcat的啟動主類org.apache.catalina.startup包下的Bootstrap類,右擊->“Run AS”->"Run Configurations",在Arguments視窗中做如下設定:
    在Program arguments中寫入:start
    在VM arguments中寫入:-Dcatalina.home="F:\project\tomcat\apache-tomcat-6.0.18-src\output\build" 。如所示:



  然後運行,可以看到tomcat啟動成功,如所示:



  (5)停止tomcat:跟上面步驟一樣,在Program arguments中寫入:stop,點擊運行。即可停止tomcat。  tomcat 源碼匯入成功後 ,就可以通過debug 一步一步的了tomcat的運行機制

tomcat源碼匯入eclipse

相關文章

聯繫我們

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