GeoServer學習手記(二):代碼下載及在Eclipse中載入
粟衛民http://www.gisdev.cn/ http://blog.csdn.net/suen/ 日期:2009-10-19
保留所有著作權。如需轉載,請聯絡作者,並在醒目位置註明出處
前面概述了GeoServer的功能(GeoServer學習手記(一):GeoServer概述,http://blog.csdn.net/suen/archive/2009/10/25/4726204.aspx),接下來我們慢慢來分析它的代碼。
分析代碼的第一步肯定是在IDE中開啟代碼,沒想到開啟GeoServer的代碼還有一點點複雜,所以先把這個介紹一下。
(1) 下載GeoServer代碼:
可以直接通過HTTP下載(http://geoserver.org/display/GEOS/Download),也可以使用SVN(svn co https://svn.codehaus.org/geoserver/branches/1.7.x geoserver_1.7.x)
(2) 使用Maven產生代碼:
cd geoserver_1.7.x/src
mvn clean install
這一步的時間比較長,因為Maven要連網下載java包,如果沒有產生成功也不用擔心,可反覆執行mvn install,它會重新下載沒有下載成功的包。
(3) 產生Eclipse工程檔案:
mvn eclipse:eclipse
(4) 在Eclipse中匯入模組:
a) Run the Eclipse ide
b) Open the Eclipse Preferences
c) Navigate to Java, Build Path, Classpath Variables and click New...
d) Create a classpath variable named “M2_REPO” and set the value to the location of the local Maven repository, and click `Ok
e) Click Ok to apply the new Eclipse preferences
f) Right-click in the Package Explorer and click Import...
g) Select Existing Projects into Workspace and click Next
h) Navigate to the geoserver_1.7.x/src directory
i) Ensure all modules are selected and click Finish
(5) 在Eclipse中開啟代碼:
匯入已經存在的工作空間,使用Geoserver源碼目錄,選擇所有的模組,點擊完成即可。可看見cofig、data、geoserver-archetype-wfsoutputformat、gwc、main、ows、platform、rest、validation、wcs、wcs1_1、web、wfs、wfs11、wms等多個工程。