在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.
然后,终于,你可以导入代码了。谢天谢地!
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步