摘要:本文详细阐述,如何基于geoserver源码构建eclipse工程文件,操作过程中除用到jdk、eclipse以外,还有git和maven,操作系统为windows8。

1安装Git

从(http://git-scm.com/download/win),下载得到Git-1.9.0-preview2014021 7.exe文件,直接安装即可。安装成功后,在任何地方右击鼠标都会有菜单“Git GUI Here”和“Git Bash Here”。

2通过git可视化界面程序checkout geoserver源码。

点击“Git GUI Here”将出现如下界面,选择“克隆已有版本”,进入源码克隆界面,输入相应的source Location(源码所在位置git://github.com/geoserver/geoserver.git) 和 Target Location(本地存储位置)。

注意:此处设置target directory时,点击浏览按钮选择目标文件夹,完成后要在路径后面添加“克隆”的文件夹名称。

Checkout 得到的源码结构如下:

3下载Maven

(http://maven.apache.org/download.cgi)选择apache-maven-3.21-bin.zip,maven是命令行程序,将下载得到的压缩包解压,在使用时临时指   定PATH变量即可。

解压后maven文件的结构如下:

4通过maven将源码构建为工程

4.1打开cmd,将目录跳转至源码所在目录下的src文件中。

4.2执行命令:

Set PATH = “maven_dir/bin”;%PATH%

临时将maven的路径添加至环境变量中。

4.3执行命令:

mvn clean install

mvn -DskipTests clean install

注意:第一条命令在构建工程的同时执行测试用例测试类文件,在命令执行过程中有可能会出现错误;第二条命令在构建工程时,不进行测试,不会有测试不通过的异常。

通过maven构建工程

[INFO] ------------------------------------------------------------------------

[INFO] Reactor Summary:

[INFO]

[INFO] GeoServer ......................................... SUCCESS [  5.916 s]

[INFO] Core Platform Module .............................. SUCCESS [  5.763 s]

[INFO] Open Web Service Module ........................... SUCCESS [  6.644 s]

[INFO] Main Module ....................................... SUCCESS [01:15 min]

[INFO] GeoServer Security Modules ........................ SUCCESS [  0.607 s]

[INFO] GeoServer JDBC Security Module .................... SUCCESS [  8.048 s]

[INFO] GeoServer LDAP Security Module .................... SUCCESS [  8.002 s]

[INFO] Web Coverage Service Module ....................... SUCCESS [  3.605 s]

[INFO] Web Coverage Service 1.0 Module ................... SUCCESS [  6.524 s]

[INFO] Web Coverage Service 1.1 Module ................... SUCCESS [ 10.715 s]

[INFO] Web Coverage Service 2.0 Module ................... SUCCESS [ 13.674 s]

[INFO] Web Feature Service Module ........................ SUCCESS [ 18.692 s]

[INFO] Web Map Service Module ............................ SUCCESS [03:41 min]

[INFO] KML support for GeoServer ......................... SUCCESS [01:17 min]

[INFO] GeoWebCache (GWC) Module .......................... SUCCESS [03:34 min]

[INFO] REST Support Module ............................... SUCCESS [  3.981 s]

[INFO] REST Configuration Service Module ................. SUCCESS [01:23 min]

[INFO] GeoServer Web Modules ............................. SUCCESS [  0.162 s]

[INFO] Core UI Module .................................... SUCCESS [02:46 min]

[INFO] WMS UI Module ..................................... SUCCESS [  5.256 s]

[INFO] GWC UI Module ..................................... SUCCESS [ 10.776 s]

[INFO] WFS UI Module ..................................... SUCCESS [  3.262 s]

[INFO] Demoes Module ..................................... SUCCESS [01:08 min]

[INFO] WCS UI Module ..................................... SUCCESS [  4.632 s]

[INFO] Security UI Modules ............................... SUCCESS [  0.155 s]

[INFO] Security UI Core Module ........................... SUCCESS [  7.840 s]

[INFO] Security UI JDBC Module ........................... SUCCESS [  4.315 s]

[INFO] Security UI LDAP Module ........................... SUCCESS [ 12.600 s]

[INFO] GeoServer Web Application ......................... SUCCESS [01:42 min]

[INFO] Community Space ................................... SUCCESS [  7.778 s]

[INFO] GeoServer Extensions .............................. SUCCESS [  0.226 s]

[INFO] ------------------------------------------------------------------------

[INFO] BUILD SUCCESS

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 19:21 min

[INFO] Finished at: 2014-03-05T16:52:55+08:00

[INFO] Final Memory: 188M/368M

[INFO] ------------------------------------------------------------------------

D:\Technology\Learnning\open_gis\geoserver\geoserver_dev\project\geoserver20140305\src>mvn -DskipTests clean install

4.4通过maven创建eclipse工程文件

执行命令:

mvn eclipse:eclipse

命令行会出现如下结果:

[INFO] ------------------------------------------------------------------------

[INFO] Reactor Summary:

[INFO]

[INFO] GeoServer ......................................... SUCCESS [ 10.022 s]

[INFO] Core Platform Module .............................. SUCCESS [  6.761 s]

[INFO] Open Web Service Module ........................... SUCCESS [  4.690 s]

[INFO] Main Module ....................................... SUCCESS [  8.291 s]

[INFO] GeoServer Security Modules ........................ SUCCESS [  0.041 s]

[INFO] GeoServer JDBC Security Module .................... SUCCESS [  0.759 s]

[INFO] GeoServer LDAP Security Module .................... SUCCESS [  1.313 s]

[INFO] Web Coverage Service Module ....................... SUCCESS [  0.299 s]

[INFO] Web Coverage Service 1.0 Module ................... SUCCESS [  1.545 s]

[INFO] Web Coverage Service 1.1 Module ................... SUCCESS [  4.898 s]

[INFO] Web Coverage Service 2.0 Module ................... SUCCESS [  0.354 s]

[INFO] Web Feature Service Module ........................ SUCCESS [  0.502 s]

[INFO] Web Map Service Module ............................ SUCCESS [  3.534 s]

[INFO] KML support for GeoServer ......................... SUCCESS [  1.063 s]

[INFO] GeoWebCache (GWC) Module .......................... SUCCESS [  9.024 s]

[INFO] REST Support Module ............................... SUCCESS [  0.285 s]

[INFO] REST Configuration Service Module ................. SUCCESS [  0.484 s]

[INFO] GeoServer Web Modules ............................. SUCCESS [  0.032 s]

[INFO] Core UI Module .................................... SUCCESS [  0.922 s]

[INFO] WMS UI Module ..................................... SUCCESS [  0.338 s]

[INFO] GWC UI Module ..................................... SUCCESS [  1.009 s]

[INFO] WFS UI Module ..................................... SUCCESS [  0.274 s]

[INFO] Demoes Module ..................................... SUCCESS [  0.408 s]

[INFO] WCS UI Module ..................................... SUCCESS [  0.604 s]

[INFO] Security UI Modules ............................... SUCCESS [  0.033 s]

[INFO] Security UI Core Module ........................... SUCCESS [  0.319 s]

[INFO] Security UI JDBC Module ........................... SUCCESS [  0.331 s]

[INFO] Security UI LDAP Module ........................... SUCCESS [  0.401 s]

[INFO] GeoServer Web Application ......................... SUCCESS [  0.595 s]

[INFO] Community Space ................................... SUCCESS [  0.032 s]

[INFO] GeoServer Extensions .............................. SUCCESS [  0.030 s]

[INFO] ------------------------------------------------------------------------

[INFO] BUILD SUCCESS

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 01:09 min

[INFO] Finished at: 2014-03-05T17:06:55+08:00

[INFO] Final Memory: 119M/447M

[INFO] ------------------------------------------------------------------------

D:\Technology\Learnning\open_gis\geoserver\geoserver_dev\project\geoserver20140305\src>

5将构建的java工程导入到eclipe中

5.1打开eclipse,选择window下的preference,在对话框中选择java->buildpath->Classpath Variables,点击“new”将本地的maven     repository路径作为classpath变量添加至工作空间中。

5.2在eclipse中点击 “file”选择“import”将创建的eclipse工程导入至eclipse中。

选择geoserver/src文件夹

工程导入后结构如下:

6运行工程

Console中出现如下记录:

log4j:WARN File option not set for appender [geoserverlogfile].

log4j:WARN Are you using FileAppender instead of ConsoleAppender?

三月 05, 2014 9:31:37 下午 org.geoserver.platform.GeoServerExtensions checkContext

警告: Extension lookup occured, but ApplicationContext is unset.

05 三月 21:31:37 INFO [geoserver.global] -

----------------------------------

- GEOSERVER_DATA_DIR: D:\Technology\Learnning\open_gis\geoserver\geoserver_dev\project\geoserver20140305\src\web\app\src\main\webapp\data

----------------------------------

05 三月 21:31:38 INFO [org.geoserver] - Loaded style 'line'

05 三月 21:31:38 INFO [org.geoserver] - Loaded style 'point'

05 三月 21:31:38 INFO [org.geoserver] - Loaded style 'polygon'

05 三月 21:31:38 INFO [org.geoserver] - Loaded style 'raster'

05 三月 21:31:38 INFO [org.geoserver] - Loaded default workspace it.geosolutions

05 三月 21:31:38 INFO [org.geoserver] - Loaded workspace 'it.geosolutions'

05 三月 21:31:38 INFO [org.geoserver] - Loaded workspace 'topp'

05 三月 21:31:38 INFO [storage.DefaultStorageFinder] - ************************************************************************************************************

05 三月 21:31:38 INFO [storage.DefaultStorageFinder] - *** Found System environment variable TEMP set to C:\Users\smartmap\AppData

\Local\Temp, using it as the default prefix. ***

05 三月 21:31:38 INFO [storage.DefaultStorageFinder] - *************************************************************************************************************

05 三月 21:31:38 INFO [config.XMLConfiguration] - Will look for geowebcache.xml in 'C:\Users\smartmap\AppData\Local\Temp\geowebcache'

05 三月 21:31:38 INFO [gwc.layer] - Initializing GWC configuration based on GeoServer's Catalog

05 三月 21:31:38 INFO [gwc.layer] - GeoServer TileLayer store base directory is: D:\Technology\Learnning\open_gis\geoserver\geoserver_dev\project\geoserver20140305\src\web\app\src\main\webapp\data\gwc-layers

05 三月 21:31:38 INFO [gwc.layer] - Loading tile layers from D:\Technology\Learnning\open_gis\geoserver\geoserver_dev\project\geoserver20140305\src\web\app\src\main\webapp\data\gwc-layers

05 三月 21:31:38 INFO [gwc.layer] - GWC configuration based on GeoServer's Catalog loaded successfuly

05 三月 21:31:38 INFO [layer.TileLayerDispatcher] - Configuration GeoServer Catalog Configuration contained no layers.

05 三月 21:31:38 INFO [config.XMLConfiguration] - Found configuration file in C:\Users\smartmap\AppData\Local\Temp\geowebcache

05 三月 21:31:38 WARN [config.XMLConfiguration] - *******************************************************************

05 三月 21:31:38 WARN [config.XMLConfiguration] - *** GWC configuration validation error: cvc-elt.1: 找不到元素 'gwcConfiguration' 的声明。

05 三月 21:31:38 WARN [config.XMLConfiguration] - *** Will try to use configuration anyway. Please check the order of declared

elements against the schema.

05 三月 21:31:38 WARN [config.XMLConfiguration] - ************************************************************

05 三月 21:31:38 INFO [config.XMLConfiguration] - Initializing GridSets from C:\Users\smartmap\AppData\Local\Temp\geowebcache

05 三月 21:31:38 INFO [config.XMLConfiguration] - Initializing layers from C:\Users\smartmap\AppData\Local\Temp\geowebcache

05 三月 21:31:38 INFO [layer.TileLayerDispatcher] - Configuration C:\Users\smartmap\AppData\Local\Temp\geowebcache contained no layers.

05 三月 21:31:39 INFO [diskquota.ConfigLoader] - DiskQuota configuration not found: C:\Users\smartmap\AppData\Local\Temp\geowebcache

\geowebcache-diskquota.xml

05 三月 21:31:39 INFO [diskquota.ConfigLoader] - DiskQuota configuration not found: C:\Users\smartmap\AppData\Local\Temp\geowebcache

\geowebcache-diskquota.xml

05 三月 21:31:39 INFO [diskquota.DiskQuotaMonitor] - Setting up disk quota periodic enforcement task

05 三月 21:31:39 INFO [diskquota.DiskQuotaMonitor] - 0 layers configured with their own quotas.

05 三月 21:31:39 INFO [diskquota.DiskQuotaMonitor] - 0 layers attached to global quota 500.0 MB

05 三月 21:31:39 INFO [diskquota.DiskQuotaMonitor] - Disk quota periodic enforcement task set up every 10 SECONDS

05 三月 21:31:39 INFO [org.geoserver] - Loaded service 'wfs', enabled

05 三月 21:31:39 INFO [org.geoserver] - Loaded service 'wms', enabled

05 三月 21:31:39 INFO [org.geoserver] - Loaded service 'wcs', enabled

05 三月 21:31:39 INFO [gwc.config] - Initializing GeoServer specific GWC configuration from gwc-gs.xml

05 三月 21:31:39 INFO [ows.OWSHandlerMapping] - Mapped URL path [/gwc/service/**] onto handler 'dispatcher'

05 三月 21:31:39 INFO [geowebcache.GeoWebCacheDispatcher] - Invoked setServletPrefix(gwc)

05 三月 21:31:39 INFO [georss.GeoRSSPoller] - Initializing GeoRSS poller in a background job...

05 三月 21:31:39 INFO [georss.GeoRSSPoller] - No enabled GeoRSS feeds found, poller will not run.

05 三月 21:31:40 INFO [rest.RESTDispatcher] - Created RESTDispatcher with 14 paths

05 三月 21:31:40 INFO [wms.WMSService] - Will NOT recombine tiles for non-tiling clients.

05 三月 21:31:40 INFO [wms.WMSService] - Will proxy requests to backend that are not getmap or getcapabilities.

05 三月 21:31:40 INFO [ows.OWSHandlerMapping] - Mapped URL path [/ows/**] onto handler 'dispatcher'

05 三月 21:31:40 INFO [ows.OWSHandlerMapping] - Mapped URL path [/ows] onto handler 'dispatcher'

05 三月 21:31:40 INFO [org.geoserver] - GeoServer configuration lock is enabled

05 三月 21:31:41 INFO [ows.OWSHandlerMapping] - Mapped URL path [/wfs/*] onto handler 'dispatcher'

05 三月 21:31:41 INFO [ows.OWSHandlerMapping] - Mapped URL path [/TestWfsPost] onto handler 'wfsTestServlet'

05 三月 21:31:41 INFO [ows.OWSHandlerMapping] - Mapped URL path [/wfs] onto handler 'dispatcher'

05 三月 21:31:45 INFO [ows.OWSHandlerMapping] - Mapped URL path [/wms/*] onto handler 'dispatcher'

05 三月 21:31:45 INFO [ows.OWSHandlerMapping] - Mapped URL path [/wms] onto handler 'dispatcher'

05 三月 21:31:46 INFO [ows.OWSHandlerMapping] - Mapped URL path [/animate] onto handler 'dispatcher'

05 三月 21:31:46 INFO [ows.OWSHandlerMapping] - Mapped URL path [/animate/*] onto handler 'dispatcher'

05 三月 21:31:46 INFO [ows.OWSHandlerMapping] - Mapped URL path [/wcs] onto handler 'dispatcher'

05 三月 21:31:46 INFO [ows.OWSHandlerMapping] - Mapped URL path [/wcs/**] onto handler 'dispatcher'

05 三月 21:31:47 INFO [ows.OWSHandlerMapping] - Mapped URL path [/kml] onto handler 'dispatcher'

05 三月 21:31:47 INFO [ows.OWSHandlerMapping] - Mapped URL path [/kml/*] onto handler 'dispatcher'

05 三月 21:31:47 INFO [ows.OWSHandlerMapping] - Mapped URL path [/kml/icon/**/*] onto handler 'kmlIconService'

在浏览器中输入http://localhost:8080/geoserver/web/可返回geoserver主页。如下图所示。

Reference

[1]Quickstart http://docs.geoserver.org/stable/en/developer/quickstart/index.html

[2]maven guide http://docs.geoserver.org/latest/en/developer/maven-guide/index.html

Eclipse下建立geoserver源码工程的更多相关文章

  1. eclipse下导入jdk源码

    一直想好好看看jdk的源码,虽然可以直接解压jdk下的src看,但是终究不方便!后来发现可以导入到eclipse中,就在网上找了一些方法,下面就和大家分共享: step1:打开eclipse选择Win ...

  2. Eclipse里导入Mybatis源码工程

    打开Eclipse,在前两天的记录里我已经把Maven什么的都配置好了,还有Mybatis的源码也下载下来了,不相信的话可以去看一下我之前的记录:) OK. Mybatis源码解压之后是一个标准的Ma ...

  3. eclipse下查看jdk源码

    打开eclipse,点 "window"-> "Preferences" -> "Java" -> "Insta ...

  4. eclipse下查看java源码设置

    myway: 1.选择一函数,按住ctrl,显示open declaration(或按F3); 2.点进去: 如果未配置,点 source attachment configuration -- ex ...

  5. 如何设置eclipse下查看java源码

    windows--preferences--java--installed jres --选中jre6--点击右边的edit--选中jre6/lib/rt.jar --点击右边的 source att ...

  6. eclipse中建geoserver源码

    概述:本文讲述的是在eclipse中如何构建geoserver源码工程,其中涉及到了jdk,github,marven等. 1.安装git 从(http://git-scm.com/download/ ...

  7. 关于导入geoserver 源码到Eclipse编译运行

    参考http://blog.csdn.net/gisshixisheng/article/details/43016443 和  http://blog.sina.com.cn/s/blog_6e37 ...

  8. Android动态方式破解apk前奏篇(Eclipse动态调试smail源码)

    一.前言 今天我们开始apk破解的另外一种方式:动态代码调试破解,之前其实已经在一篇文章中说到如何破解apk了: Android中使用静态方式破解Apk  主要采用的是静态方式,步骤也很简单,首先使用 ...

  9. 获取hadoop的源码和通过eclipse关联hadoop的源码

    一.获取hadoop的源码 首先通过官网下载hadoop-2.5.2-src.tar.gz的软件包,下载好之后解压发现出现了一些错误,无法解压缩, 因此有部分源码我们无法解压 ,因此在这里我讲述一下如 ...

随机推荐

  1. 在Visual C++下搭建OpenGL的开发环境

    1.确保你的电脑已经安装了visual c++编译器 如果还没安装的话,这里有个安装包,可以复制链接进行下载:http://pan.baidu.com/s/1bn4XTqn   2.下载GLUT 下载 ...

  2. Android构建boot.img(二):kernel的拷贝与打包

    上文已经对boot.img其中组成部分之一ramdisk.img做了分析,boot.img另外一个重要的组成部分就是kernel了, 这里所说的kernel,可以只理解为位于out/target/pr ...

  3. HDU 1941 Hide and Seek(离散化+树状数组)

    题目链接:http://61.187.179.132/JudgeOnline/problem.php?id=1941 题意:给出平面上n个点,找出一点p,使得距离p最近和最远的点的距离之差最小.输出这 ...

  4. leetcode Database1(三)

    一.Rising Temperature Given a Weather table, write a SQL query to find all dates' Ids with higher tem ...

  5. JSON 之 SuperObject(3): 访问

    测试数据提前加入 Memo1 中: 代码文件: unit Unit1; interface uses   Windows, Messages, SysUtils, Variants, Classes, ...

  6. POJ 1458 最长公共子序列

    子序列就是子序列中的元素是母序列的子集,且子序列中元素的相对顺序和母序列相同. 题目要求便是寻找两个字符串的最长公共子序列. dp[i][j]表示字符串s1左i个字符和s2左j个字符的公共子序列的最大 ...

  7. 4630 no pain no game 树状数组

    题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=4630 题意:给你N个数,然后给你M个询问,每个询问包含一个l 一个r,问你lr 这个区间中任意两个数最 ...

  8. Bitset位图

    位图(bitmap)就是用每一位来存放某种状态,适合于大规模数据但是数据状态又不是很多的情况下,通常来判断数据是否存在.位图的常见应用有两种: 1.存放大规模数据,例如腾讯的面试题,给40亿个unsi ...

  9. 20160125.CCPP详解体系(0004天)

    程序片段(01):宽字符.c 内容概要:宽字符 #include <stdio.h> #include <stdlib.h> #include <Windows.h> ...

  10. Spark源码阅读(1): Stage划分

    Spark中job由action动作生成,那么stage是如何划分的呢?一般的解答是根据宽窄依赖划分.那么我们深入源码看看吧 一个action 例如count,会在多次runJob中传递,最终会到一个 ...