在Eclipse中部署GeoServer代碼

For a comprehensive guide for developers, go the main documentation site:

http://geoserver.org/display/GEOSDOC/Developers+Guide

可以到上面的URL上查看英文版本。

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

1) Install JAVA SDK

Download and install the Java SDK.

首先要安裝Java SDK,這點誰都知道,你不知道?百度一下,你就知道了。

Create an environment variable called JAVA_HOME and point it to your Java SDK directory.

Then modify the PATH variable and add: ;%JAVA_HOME%/bin

Apply the changes.

打開Windows的環境變量,要改兩個地方,一個是JAVA_HOME,另一個是Path,還可以增加一個CLASSPATH,內容:.;%JAVA_HOME%/lib/tool.jar;%JAVA_HOME%/jre/lib/rt.jar;

2) Download Subversion

Windows: http://subversion.tigris.org/files/documents/15/29065/svn-1.3.0-setup.exe

Linux: http://subversion.tigris.org/project_packages.html

Install subversion.

下載Subversion,就是SVN,這是一個代碼構建、版本管理工具,是CVS的接班人。安裝它!右鍵菜單中會出現它的選項。

3) Checkout the Source Code

Using SVN Checkout, get the source code:

svn checkout https://svn.codehaus.org/geoserver/trunk

用SVN到上面的那個網址:https://svn.codehaus.org/geoserver/trunk去遷代碼。

4) Download and install Maven

Windows: http://www.apache.org/dyn/closer.cgi/maven/binaries/maven-2.0.4.exe

Linux: http://www.apache.org/dyn/closer.cgi/maven/binaries/maven-2.0.4.zip

If you are using Linux, execute the following commands:

export M2_HOME=/usr/java/maven-2.0.4

export PATH=$PATH:$M2_HOME/bin

下載和安裝Maven工具,並且添上這兩個環境變量,一會兒要在Eclipse中用。安裝完成後,cmd,運行mvn –version查看Maven的版本號,如果沒成功?重裝吧,不定哪兒出錯了。

5) Build Source Code

Go to the command line and navigate to the root of the source tree that you just downloaded.

Execute the command:

mvn install

If it fails, just try again. It trys to download jars and some might not be available at that time. So just keep trying.

現在要進入正式環節了,把你下載的源碼(還沒下,你別看了,把這篇文章關了吧)解壓到你想要的位置,然後cmd,cd到你解壓的位置,執行mvn install命令。沒成功?多試幾次吧,不會一次就成功的。停了?別傻等着了,Ctrl+C結束它,然後重新mvn install。最後看到BUILD SUCCESSFUL,恭喜你,修成正果了。

很少能夠修成正果的,你可以嘗試換種方法,就是一個一個模塊的mvn install,比如main、wcs等等。或者可以換成mvn compile,不執行mvn test生命週期。(沒有成功貌似也沒有什麼影響,可以執行下一步,別拍我……)你有更好的方法?請與我聯繫。

If it succeeds, run the next command:

mvn eclipse:eclipse

如果成功了-_-!!!,執行mvn eclipse:eclipse這個命令。(好像沒成功也可以)

6) Set up Eclipse

Windows: http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.1.2-200601181600/eclipse-SDK-3.1.2-win32.zip

Linux GTK: http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.1.2-200601181600/eclipse-SDK-3.1.2-linux-gtk.tar.gz

Linux Motif: http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.1.2-200601181600/eclipse-SDK-3.1.2-linux-motif.tar.gz

Install Eclipse.

安裝Eclipse,你不會?-_-!!!,那祝你一切順利吧!其實不用安裝,啓動就行……

Start up Eclipse.

Got to: Windows -> Preferences

In the wondow that pops up click on Java -> Build Path -> Classpath Variables

On the Classpath Variables panel, select New

Define a new variables called M2_REPO and set it to your local maven repository. (for windows it would be C:/Documents and Settings/username/.m2/repository)

打開Eclipse,執行Windows->Preferences(窗口->選項),在彈出的對話框中選擇 Java->Bulid Path->Classpath Variables,然後單擊New按鈕,新建一個M2_REPO的環境變量,指向你的Maven安裝的本地倉庫(一般爲:C:/Documents and Settings/username/.m2/repository,username是你的用戶名,你可以看看有沒有)

7) Get the Code into Eclipse

Import existing projects into the workspace, use the root of your geoserver source tree.

Select all of the modules. Hit Finish.

然後,終於,你可以導入代碼了。謝天謝地!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章