琳琅试用首页手机版:GeoServer学习手记(二):代码下载及在Eclipse中加载

来源:百度文库 编辑:中财网 时间:2024/04/29 21:39:28

前面概述了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等多个工程。