https://docs.geoserver.org/latest/en/developer/
GeoServer Developer Manual
Welcome to the GeoServer Developer Manual. The manual is for those who want to help with the development process, including source code, software releasing, and other administrative work.
- Introduction
- Tools
- Source Code
- Quickstart
- Maven Guide
- Eclipse Guide
- Automatic Quality Assurance checks
- PMD checks
- Error Prone
- Spotbugs
- Checkstyle
- Programming Guide
- Release Schedule
- Release Guide
- Release Testing Checklist
- Cite Test Guide
- Translating GeoServer
- Policies and Procedures
- Build Windows installer
第一章:Introduction
Welcome to GeoServer development. The project makes use of a number of resources:
-
https://github.com/geoserver/geoserver.github.io/wiki Wiki used for Proposals
-
https://github.com/geoserver/geoserver Github source code
-
https://osgeo-org.atlassian.net/projects/GEOS Jira issue tracker
Communication channels:
-
geoserver-devel email list
-
geoserver-users email list
We have a number of build servers employed to assist with day to day activities:
-
https://build.geoserver.org/view/geoserver/ (main build server)
-
http://office.geo-solutions.it/jenkins/ (windows build server)
Notification email lists:
Question and answer:
License
For complete license information review LICENSE.txt
.
-
GeoServer is free software and is licensed under the
GNU General Public License
:
Additionally:
-
Several files supporting GZIP compressions (GZIPFilter, GZIPResponseStream, GZIPResponseWrapper are provided using:
/* Copyright 2003 Jayson Falkner (jayson@jspinsider.com) This code is from "Servlets and JavaServer pages; the J2EE Web Tier",http://www.jspbook.com. You may freely use the code both commercially and non-commercially. If you like the code, please pick up a copy of * the book and help support the authors, development of more free code, and the JSP/Servlet/J2EE community. Modified by David Winslow <dwinslow@openplans.org>*/
-
SetCharacterEncodingFilter and RewindableInputStream makes use of code provided under
Apache License Version 2.0
. -
UCSReader is provided using
Apache License Version 1.1
. -
Snippets from the Prototype library (www.prototypejs.org) under a MIT license.
-
The build process will download jars from JAI ImageIO (BSD), Jetty (Jetty License), EMF (EPL), XSD (EPL). Several projects using the Apache License 2.0: Spring, Apache Commons, Log4j, Batik, Xerces.
第二章:Tools
The following tools need to installed on the system before a GeoServer developer environment can be set up.
Java
Developing with GeoServer requires a Java Development Kit (JDK), version 8, available from OpenJDK, AdoptOpenJDK for Windows and macOS installers, or provided by your OS distribution.
Due to subtle changes in Java class libraries we require development on Java 8 at this time (although the result is tested on Java 11).
Maven
GeoServer uses a tool known as Maven to build.
Maven tracks global settings in your home directory .m2/settings.xml. This file is used to control global options such as proxy settings or listing repository mirrors to download from.
Git
GeoServer source code is stored and version in a git repository on github There are a variety of git clients available for a number of different platforms. Visit http://git-scm.com/ for more details.
第三章:Source Code
The GeoServer source code is located on GitHub at https://github.com/geoserver/geoserver.
To clone the repository:
% git clone git://github.com/geoserver/geoserver.git geoserver
To list available branches in the repository:
% git branch
2.15.x
2.16.x
* main
To switch to the 2.16.x branch above:
% git checkout 2.16.x
3.1 Git
Git is a distributed version control system with a steep learning curve. Luckily there is lots of great documentation around. Before continuing developers should take the time to educate themselves about git. The following are good references:
-
The Git Book
-
A nice introduction
-
Git Pull Requests
3.2 Git client configuration
To review global settings:
$ git config --global --get-regexp core.*
On Linux and Windows machines:
core.autocrlf input
core.safecrlf true
On macOS using decomposed unicode paths, and a default APFS case-insensitive file system:
core.autocrlf input
core.safecrlf true
core.ignorecase false
core.precomposeunicode true
We recommend making these changes to --global
(or --system
) as they reflect the operating system and file system on your local machine.
Some useful reading on this subject:
-
git config (git)
3.3 Committing
n order to commit the following steps must be taken:
-
Configure your git client for cross platform projects. See notes below.
-
Register for commit access as described here.
-
Fork the canonical GeoServer repository into your github account.
-
Clone the forked repository to create a local repository
-
Create a remote reference to the canonical repository using a non-read only URL (
git@github.com:geoserver/geoserver.git
).
3.4 Repository distribution
Git is a distributed versioning system which means there is strictly no notion of a single central repository, but many distributed ones. For GeoServer these are:
-
The canonical repository located on GitHub that serves as the official authoritative copy of the source code for project
-
Developers’ forked repositories on GitHub. These repositories generally contain everything in the canonical repository, as well any feature or topic branches a developer is working on and wishes to back up or share.
-
Developers’ local repositories on their own systems. This is where development work is actually done.
Even though there are numerous copies of the repository they can all interoperate because they share a common history. This is the magic of git!
In order to interoperate with other repositories hosted on GitHub, a local repository must contain remote references to them. A local repository typically contains the following remote references:
-
A remote called origin that points to the developers’ forked GitHub repository.
-
A remote called upstream that points to the canonical GitHub repository.
-
Optionally, some remotes that point to other developers’ forked repositories on GitHub.
3.5 Repository structure
A git repository contains a number of branches. These branches fall into three categories:
-
Primary branches that correspond to major versions of the software
-
Release branches that are used to manage releases of the primary branches
-
Feature or topic branches that developers do development on
3.6 Codebase structure
Each branch has the following structure:
build/
doc/
src/
data/
-
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
3.7 Development workflow
This section contains examples of workflows a developer will typically use on a daily basis. To follow these examples it is crucial to understand the phases that a changeset goes though in the git workflow. The lifecycle of a single changeset is:
-
The change is made in a developer’s local repository.
-
The change is staged for commit.
-
The staged change is committed.
-
The committed changed is pushed up to a remote repository
There are many variations on this general workflow. For instance, it is common to make many local commits and then push them all up in batch to a remote repository. Also, for brevity multiple local commits may be squashed into a single final commit.
3.8 More useful reading
The content in this section is not intended to be a comprehensive introduction to git. There are many things not covered that are invaluable to day-to-day work with git. Some more useful info:
第四章:Quickstart
A step by step guide describing how to quickly get up and running with a GeoServer development environment. This guide assumes that all the necessary Tools are installed.
一步一步指导教程描述了如何快速上手搭建并运行GeoServer开发环境。本向导假设所有必须的工具都已经安装好了。
4.1 Maven Quickstart
This guide is designed to get developers up and running as quick as possible. For a more comprehensive guide see the Maven Guide.
Check out source code
Check out the source code from the git repository.:
git clone git://github.com/geoserver/geoserver.git geoserver
To list the available branches.:
% git branch
2.15.x
2.16.x
* master
Choose master
for the latest development.:
% git checkout master
Or chose a stable branch for versions less likely to change often:
% git checkout 2.16.x
In this example we will pretend that your source code is in a directory called geoserver
, but a more descriptive name is recommended.
Command line build
#. Change directory to the root of the source tree and execute the maven build command:
cd geoserver/src
mvn install -DskipTests -T 2C
This will result in significant downloading of dependencies on the first build.
-
A successful build will result in output that ends with something like the following:
[INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] GeoServer 2.15-SNAPSHOT ............................ SUCCESS [ 3.735 s] [INFO] Core Platform Module ............................... SUCCESS [ 1.926 s] [INFO] Open Web Service Module ............................ SUCCESS [ 1.079 s] [INFO] Main Module ........................................ SUCCESS [ 7.371 s] [INFO] GeoServer Security Modules ......................... SUCCESS [ 0.172 s] [INFO] GeoServer Security Tests Module .................... SUCCESS [ 2.040 s] [INFO] GeoServer JDBC Security Module ..................... SUCCESS [ 0.904 s] [INFO] GeoServer LDAP Security Module ..................... SUCCESS [ 1.823 s] [INFO] Web Coverage Service Module ........................ SUCCESS [ 0.812 s] [INFO] Web Coverage Service 1.0 Module .................... SUCCESS [ 1.432 s] [INFO] Web Coverage Service 1.1 Module .................... SUCCESS [ 2.370 s] [INFO] Web Coverage Service 2.0 Module .................... SUCCESS [ 0.970 s] [INFO] Web Feature Service Module ......................... SUCCESS [ 3.658 s] [INFO] Web Map Service Module ............................. SUCCESS [ 1.899 s] [INFO] KML support for GeoServer .......................... SUCCESS [ 0.757 s] [INFO] gs-rest ............................................ SUCCESS [ 1.977 s] [INFO] GeoWebCache (GWC) Module ........................... SUCCESS [ 1.059 s] [INFO] gs-restconfig ...................................... SUCCESS [