GeoServer开发环境搭建

1|0前言

本文用于记录GeoServer开发环境的搭建过程

release

通过GeoServer发布计划可以看到,在2.23.x版本开始,会移除对jdk1.8的支持。那么当前我们会选择2.22.x版本进行研究

1|1环境

  • JAVA:1.8或11
  • Maven
  • Git

2|0Action

2|1获取源码

git clone git://github.com/geoserver/geoserver.git geoserver # or git clone https://github.com/geoserver/geoserver.git geoserver

2|2代码库结构

Each branch has the following structure:

  • build - release and continuous integration scripts
  • doc - sources for the user and developer guides
  • src - java sources for GeoServer itself
  • data - a variety of GeoServer data directories / configurations

2|3切换到2.22.x分支

# 查看分支 git branch -av # 切换分支 git checkout -b 2.22.x origin/2.22.x

002-002

002-003

2|4Import modules into IntelliJ

  1. Run the IntelliJ IDE

  2. From the initial panel select Open.

002-004

  1. Navigate to the geoserver/src/pom.xml directory and click OK.

002-005

  1. When asked click on Open as a Project.

002-006

  1. Optionally, depending on which platform, IntelliJ may ask to Trust the Project.

002-007

  1. Wait for IntelliJ to Sync the dependencies, it’s possible to follow the process from the Build tab panel on the bottom.

002-008

2|5Finalize the GeoServer Project configuration

  1. Click File > Project Structure.

002-009

  1. Update the Name and select the correct SDK accordingly to the GeoServer version.

002-010

  1. Click File > Settings.

002-011

  1. From Build, Execution, Deployment > Compiler > Annotation Processors, enable the Annotation processing.

002-012

  1. Click Build > Rebuild Project.

002-013

2|6Run GeoServer from IntelliJ

  1. From the Project browser select the web-app module
  2. Navigate to the org.geoserver.web package
  3. Right-click the Start class and click to Modify Run Configuration...

如果没有该选项,那么直接去Edit Configurations处创建一个即可,Add Configuration,选择Application

002-014

  1. It is important to correctly set the Working directory to src/web/app. While having the Edit Configurations dialog open, fine tune the launch environment (including setting a GEOSERVER_DATA_DIR or the jetty.port). When settings are satisfactory, click OK.

002-015

002-016

  1. It’s possible now to run GeoServer by selecting Run -> Run 'Start'

002-017

第一次启动比较慢

002-018

2|7Access GeoServer front page

3|0FAQ

3|1依赖下载失败或过慢(该条仅供参考)

使用阿里云Maven镜像加速依赖下载,可以参考阿里云Maven向导进行设置【有代理应该就不需要了】

maven配置文件优先级,maven工具所在的conf配置 > 外部化配置

3|2编译提示Node不存在(wcs1_1)

002-019

网络上有一些提示是:手动添加Node的依赖。但是我认为应该不需要手动设置才是,因为从官网的maven quick start中,并未使用任何的编辑器,直接命令行搞定。

# skip unit tests, skip spotless(Spotless is used as a fast way to check that the google-java-format is being applied to the codebase.) mvn clean install -DskipTests -Dspotless.apply.skip=true # 不想install, package也可以 mvn clean package -DskipTests -Dspotless.apply.skip=true

这个时候可以看到,Node这个类存在于编译后的代码中

002-020

通过跟踪构建过程可以看到,是由javacc在编译过程中生成的(根据rangeset.jjt文件,知识盲区了)

002-021

其实在官方文档中已经提到了如何处理该问题的,参见Troubleshooting#1,就是需要先完成wcs1_1模块的编译构建。

我就不管那么多了,直接把所有的都构建了

3|3Maven 使用

参见:GeoServer Maven Guide

4|0参考


__EOF__

本文作者Fuyi Atlas
本文链接https://www.cnblogs.com/threadj/p/18172245.html
关于博主:评论和私信会在第一时间回复。或者直接私信我。
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角推荐一下。您的鼓励是博主的最大动力!
posted @   拂衣志  阅读(253)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
点击右上角即可分享
微信分享提示