zoukankan      html  css  js  c++  java
  • GeoServer开发手册

    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

    Welcome to GeoServer development. The project makes use of a number of resources:

    Communication channels:

    We have a number of build servers employed to assist with day to day activities:

    Notification email lists:

    Question and answer:

    License

    For complete license information review LICENSE.txt.

    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.

    NextTools

    第二章: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 OpenJDKAdoptOpenJDK 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.

    PreviousIntroduction

    第三章: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:

    1. Configure your git client for cross platform projects. See notes below.

    2. Register for commit access as described here.

    3. Fork the canonical GeoServer repository into your github account.

    4. Clone the forked repository to create a local repository

    5. 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:

    1. Primary branches that correspond to major versions of the software

    2. Release branches that are used to manage releases of the primary branches

    3. 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:

    1. The change is made in a developer’s local repository.

    2. The change is staged for commit.

    3. The staged change is committed.

    4. 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.
    
    1. 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 [  1.448 s]
      [INFO] gs-restconfig-wcs .................................. SUCCESS [  0.218 s]
      [INFO] gs-restconfig-wfs .................................. SUCCESS [  0.229 s]
      [INFO] gs-restconfig-wms .................................. SUCCESS [  0.333 s]
      [INFO] GeoServer Web Modules .............................. SUCCESS [  0.055 s]
      [INFO] Core UI Module ..................................... SUCCESS [  6.905 s]
      [INFO] WMS UI Module ...................................... SUCCESS [  0.884 s]
      [INFO] GWC UI Module ...................................... SUCCESS [  1.086 s]
      [INFO] WFS UI Module ...................................... SUCCESS [  0.351 s]
      [INFO] Demos Module ....................................... SUCCESS [  0.744 s]
      [INFO] WCS UI Module ...................................... SUCCESS [  0.261 s]
      [INFO] Security UI Modules ................................ SUCCESS [  0.115 s]
      [INFO] Security UI Core Module ............................ SUCCESS [  1.241 s]
      [INFO] Security UI JDBC Module ............................ SUCCESS [  0.239 s]
      [INFO] Security UI LDAP Module ............................ SUCCESS [  0.209 s]
      [INFO] REST UI Module ..................................... SUCCESS [  0.204 s]
      [INFO] GeoServer Web Application .......................... SUCCESS [  3.266 s]
      [INFO] Community Space .................................... SUCCESS [  0.054 s]
      [INFO] GeoServer Extensions 2.15-SNAPSHOT ................. SUCCESS [  0.055 s]
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 26.451 s (Wall Clock)
      [INFO] Finished at: 2018-08-27T15:52:42+03:00
      [INFO] ------------------------------------------------------------------------
      
    2. Navigate to the web-app folder:

      cd web/app
      
    3. Run GeoServer:

      mvn jetty:run
      
    4. Use the browser to open:

      http://localhost:8080/geoserver/

    4.2 Intellij Quickstart

    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.

    Import modules into Intellij

    1. Run the Intellij IDE

    2. Select File -> New -> Project from Existing Sources....

    3. Navigate to the geoserver/src/pom.xml directory and click Open.

      ../_images/intellij_import.png
    4. Click Next, leaving all profiles unchecked.

      ../_images/intellij_import_profile.png
    5. Click Next, leaving the geoserver project checked.

      ../_images/intellij_import_project.png
    6. Click Next, selecting the Java 8 JDK of your choice.

      ../_images/intellij_import_jdk.png
    7. Click Finish

      ../_images/intellij_import_finish.png

    Run 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 Run 'Start.main()'

      ../_images/intellij_run.png
    4. The first time you do this, geoserver will fail to start. Navigate to the Run menu, an click Edit Configurations....

    5. Select the Start configuration, and append web/app to the Working Directory.

      ../_images/intellij_run_config.png
    6. While you have the Edit Configurations dialog open, you can fine tune your launch environment (including setting a GEOSERVER_DATA_DIR). When you are happy with your settings, click OK.

    7. If there are errors such as “cannot find symbol class ASTAxisId”, some generated code is not being included in the build. Using wcs1_1 as the working directory, run a mvn clean install.

    8. If you get a compiler error like java.lang.NoSuchMethodError, it is most likely due to Error Prone tool which doesn’t support Java 8. This tool is switched off by default, but sometimes it turns on after import to IntelliJ. There are two options to fix it:
      1. Go to Maven tool window and uncheck the errorprone profile, then click Reimport All Maven Projects:

        ../_images/intellij_maven_errorprone.png
      2. If you want to use errorprone, notably to perform the QA checks, install the Error Prone Compiler plugin, restart the IDE and set Javac with error-prone as a default compiler for the project. Please note that this will slower the build.

    9. You can now re-run GeoServer. Select Run -> Run 'Start'

    Note

     

    If you already have a server running on localhost:8080 see the Eclipse Guide for instructions on changing to a different port.

    Run GeoServer with Extensions

    The above instructions assume you want to run GeoServer without any extensions enabled. In cases where you do need certain extensions, the web-app module declares a number of profiles that will enable specific extensions when running Start. To enable an extension, open the Maven Projects window (View -> Tool Windows -> Maven Projects) and select the profile(s) you want to enable.

    ../_images/intellij_run_profile.png

    The full list of supported profiles can be found in src/web/app/pom.xml.

    Access GeoServer front page

    Run GeoServer from Intellij on Windows

    1. Add bash to your Windows environment path and restart Intellij.

    2. If there are errors such as “cannot find symbol AbstractUserGroupServiceTest”, rebuild the security-tests project in the security module. Right click on the security-tests project and click Rebuild.

    4.3 Maven Eclipse Plugin Quickstart

     This guide is designed to get developers up and running as quick as possible. For a more comprehensive guide see the the Eclipse 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.

    Generate Eclipse project files with Maven

    Generate the eclipse .project and .classpath files:

    mvn eclipse:eclipse

    Import modules into Eclipse

    1. Run the Eclipse IDE

    2. Open the Eclipse Preferences

    3. Navigate to JavaBuild PathClasspath Variables and click New...

      ../_images/eclipse_m2repo1.jpg
    4. Create a classpath variable named “M2_REPO” and set the value to the location of the local Maven repository, and click Ok

      ../_images/eclipse_m2repo2.jpg
    5. Click Ok to apply the new Eclipse preferences

    6. Right-click in the Package Explorer and click Import...

      ../_images/eclipse_import1.jpg
    7. Select Existing Projects into Workspace and click Next

      ../_images/eclipse_import2.jpg
    8. Navigate to the geoserver/src directory

    9. Ensure all modules are selected and click Finish

      ../_images/eclipse_import3.jpg

    Run GeoServer from Eclipse

    1. From the Package Explorer select the web-app module

    2. Navigate to the org.geoserver.web package

    3. Right-click the Start class and navigate to Run asJava Application

      ../_images/eclipse_run1.jpg
    4. After running the first time you can return to the Run Configurations dialog to fine tune your launch environment (including setting a GEOSERVER_DATA_DIR).

    Note

     

    If you already have a server running on localhost:8080 see the Eclipse Guide for instructions on changing to a different port.

    Run GeoServer with Extensions

    The above instructions assume you want to run GeoServer without any extensions enabled. In cases where you do need certain extensions, the web-app module declares a number of profiles that will enable specific extensions when running Start. To enable an extension, re-generate the root eclipse profile with the appropriate maven profile(s) enabled:

    % mvn eclipse:eclipse -P wps
    

    The full list of supported profiles can be found in src/web/app/pom.xml.

    Access GeoServer front page

    4.4 Eclipse M2 Quickstart

    第五章:Maven Guide

    第六章:Eclipse Guide

    第七章:Automatic Quality Assurance checks

    第八章:PMD checks

    第九章:Error Prone

    第十章:Spotbugs

    第十一章:Checkstyle

    第十二章:Programming Guide

    12.1 OWS Services

    The Open Geospatial Consortium (OGC) defines of series of web protocols that all follow a similar design. The OGC Open Web Services (OWS) define a service using:

    • Service
    • Version
    • Request - a service

    GeoServer provides a framework for accepting these requests and dispatching them to the appropriate implementation. The services are configured for the Dispatcher using a Spring applicationContext.xml file included in your jar.

    Implementing a simple OWS service

    This section explains How to Create a Simple GeoServer OWS service for GeoServer using the following scenario. The service should supply a capabilities document which advertises a single operation called “sayHello”. The result of a sayHello operation is the simple string “Hello World”.

    Setup

    The first step in creating our plug-in is setting up a maven project for it. The project will be called “hello”.

    1. Create a new directory called hello anywhere on your file system.

    2. Add a maven pom called pom.xml to the hello directory:

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    
    <modelVersion>4.0.0</modelVersion>
    
    <!-- set parent pom to community pom -->
    <parent>
        <groupId>org.geoserver</groupId>
        <artifactId>community</artifactId>
        <version>2.20-SNAPSHOT</version> <!-- change this to the proper GeoServer version -->
    </parent>  
    
    <groupId>org.geoserver</groupId>
    <artifactId>hello</artifactId>
    <packaging>jar</packaging>
    <version>1.0</version>
    <name>Hello World Service Module</name>
    
    <!-- declare dependency on geoserver main -->
    <dependencies>
        <dependency>
            <groupId>org.geoserver</groupId>
            <artifactId>gs-main</artifactId>
            <version>2.20-SNAPSHOT</version> <!-- change this to the proper GeoServer version -->
        </dependency>
    </dependencies>
    
    <repositories>
        <repository>
            <id>boundless</id>
            <name>Boundless Maven Repository</name>
            <url>https://repo.boundlessgeo.com/snapshot</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>
    
    </project>
    
    1. Create a java source directory, src/main/java under the hello directory:

      hello/
        + pom.xml
        + src/
          + main/
            + java/
      

    Creating the Plug-in

    A plug-in is a collection of extensions realized as spring beans. In this example the extension point of interest is a HelloWorld POJO (Plain Old Java Object).

    1. Create a class called HelloWorld:

    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    
    public class HelloWorld {
    
        public HelloWorld() {
            // Do nothing
        }
    
        public void sayHello(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
            response.getOutputStream().write("Hello World".getBytes());
        }
    }
    

    The service is relatively simple. It provides a method sayHello(..) which takes a HttpServletRequest, and a HttpServletResponse. The parameter list for this function is automatically discovered by the org.geoserver.ows.Dispatcher.

    1. Create an applicationContext.xml declaring the above class as a bean.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    
    <beans>
        <!-- Spring will reference the instance of the HelloWorld class
                by the id name "helloService" -->
        <bean id="helloService" class="HelloWorld"/>
    
        <!-- This creates a Service descriptor, which allows the org.geoserver.ows.Dispatcher
            to locate it. -->
        <bean id="helloService-1.0.0" class="org.geoserver.platform.Service">
        
            <!-- used to reference the service in the URL -->
            <constructor-arg index="0" value="hello"/>
    
            <!-- our actual service POJO defined previously -->
            <constructor-arg index="1" ref="helloService"/>
    
            <!-- a version number for this service -->
            <constructor-arg index="2" value="1.0.0"/>
                
            <!-- a list of functions for this service -->
            <constructor-arg index="3">
                <list>
                    <value>sayHello</value>
                </list>
            </constructor-arg>
            
        </bean>
    </beans>
    

    At this point the hello project should look like the following:

    hello/
      + pom.xml
      + src/
        + main/
          + java/
            + HelloWorld.java
            + applicationContext.xml
    

    Trying it Out

    1. Install the hello module:

    [hello]% mvn install
    
    [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] Building Hello World Service Module 1.0
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ hello ---
    [INFO] Deleting /home/bradh/devel/geoserver/doc/en/developer/source/programming-guide/ows-services/hello/target
    [INFO]
    [INFO] --- cobertura-maven-plugin:2.6:clean (default) @ hello ---
    [INFO]
    [INFO] --- git-commit-id-plugin:2.0.4:revision (default) @ hello ---
    [INFO] [GitCommitIdMojo] .git directory could not be found, skipping execution
    [INFO]
    [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ hello ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Copying 1 resource
    [INFO] skip non existing resourceDirectory /home/bradh/devel/geoserver/doc/en/developer/source/programming-guide/ows-services/hello/src/main/resources
    [INFO]
    [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ hello ---
    [INFO] Compiling 1 source file to /home/bradh/devel/geoserver/doc/en/developer/source/programming-guide/ows-services/hello/target/classes
    [INFO]
    [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ hello ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] skip non existing resourceDirectory /home/bradh/devel/geoserver/doc/en/developer/source/programming-guide/ows-services/hello/src/test/java
    [INFO] skip non existing resourceDirectory /home/bradh/devel/geoserver/doc/en/developer/source/programming-guide/ows-services/hello/src/test/resources
    [INFO]
    [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ hello ---
    [INFO] No sources to compile
    [INFO]
    [INFO] --- maven-surefire-plugin:2.12.3:test (default-test) @ hello ---
    [INFO] No tests to run.
    [INFO]
    [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ hello ---
    [INFO] Building jar: /home/bradh/devel/geoserver/doc/en/developer/source/programming-guide/ows-services/hello/target/hello-1.0.jar
    [INFO]
    [INFO] --- maven-jar-plugin:2.4:test-jar (default) @ hello ---
    [WARNING] JAR will be empty - no content was marked for inclusion!
    [INFO] Building jar: /home/bradh/devel/geoserver/doc/en/developer/source/programming-guide/ows-services/hello/target/hello-1.0-tests.jar
    [INFO]
    [INFO] >>> maven-source-plugin:2.2.1:jar (attach-sources) > generate-sources @ hello >>>
    [INFO]
    [INFO] --- git-commit-id-plugin:2.0.4:revision (default) @ hello ---
    [INFO] [GitCommitIdMojo] .git directory could not be found, skipping execution
    [INFO]
    [INFO] <<< maven-source-plugin:2.2.1:jar (attach-sources) < generate-sources @ hello <<<
    [INFO]
    [INFO] --- maven-source-plugin:2.2.1:jar (attach-sources) @ hello ---
    [INFO] Building jar: /home/bradh/devel/geoserver/doc/en/developer/source/programming-guide/ows-services/hello/target/hello-1.0-sources.jar
    [INFO]
    [INFO] >>> maven-source-plugin:2.2.1:test-jar (attach-sources) > generate-sources @ hello >>>
    [INFO]
    [INFO] --- git-commit-id-plugin:2.0.4:revision (default) @ hello ---
    [INFO] [GitCommitIdMojo] .git directory could not be found, skipping execution
    [INFO]
    [INFO] <<< maven-source-plugin:2.2.1:test-jar (attach-sources) < generate-sources @ hello <<<
    [INFO]
    [INFO] --- maven-source-plugin:2.2.1:test-jar (attach-sources) @ hello ---
    [INFO] No sources in project. Archive not created.
    [INFO]
    [INFO] --- maven-install-plugin:2.4:install (default-install) @ hello ---
    [INFO] Installing /home/bradh/devel/geoserver/doc/en/developer/source/programming-guide/ows-services/hello/target/hello-1.0.jar to /home/bradh/.m2/repository/org/geoserver/hello/1.0/hello-1.0.jar
    [INFO] Installing /home/bradh/devel/geoserver/doc/en/developer/source/programming-guide/ows-services/hello/pom.xml to /home/bradh/.m2/repository/org/geoserver/hello/1.0/hello-1.0.pom
    [INFO] Installing /home/bradh/devel/geoserver/doc/en/developer/source/programming-guide/ows-services/hello/target/hello-1.0-tests.jar to /home/bradh/.m2/repository/org/geoserver/hello/1.0/hello-1.0-tests.jar
    [INFO] Installing /home/bradh/devel/geoserver/doc/en/developer/source/programming-guide/ows-services/hello/target/hello-1.0-sources.jar to /home/bradh/.m2/repository/org/geoserver/hello/1.0/hello-1.0-sources.jar
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 2.473 s
    [INFO] Finished at: 2015-10-20T10:14:16+11:00
    [INFO] Final Memory: 23M/589M
    [INFO] ------------------------------------------------------------------------
    
    1. Next we need to make sure hello-1.0.jar is included when we run GeoServer:

      • If you are running a GeoServer in Tomcat, copy target/hello-1.0.jar into webapps/geoserver/WEB-INF/lib (just like we manually install extensions or community modules).

        Restart GeoServer to pick up the change.

      • If running with Eclipse using maven eclipse plugin, the easiest approach is edit the web-app/pom.xml with the following dependency:

         <dependency>
            <groupId>org.geoserver</groupId>
            <artifactId>hello</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
        

        After editing webapps/pom.xml we need run mvn eclipse:eclipse, and then from Eclipse right click on web-app project and Refresh for the IDE to notice the change.

      • If and IDE like IntellJ, Eclipse M2 Maven plugin or NetBeans refresh the project so it picks up the changes to pom.xml

    2. Restart GeoServer and visit:

      http://<host>/geoserver/ows?request=sayHello&service=hello&version=1.0.0
      
      request

      the method we defined in our service

      service

      the name we passed to the Service descriptor in the applicationContext.xml

      version

      the version we passed to the Service descriptor in the applicationContext.xml

    ../../_images/firefox_helloworld.png

    Note

     

    A common pitfall is to bundle an extension without the applicationContext.xml file. If you receive the error message “No service: ( hello )” this is potentially the case. To ensure the file is present inspect the contents of the hello jar present in the target directory of the hello module.

    Bundling with Web Module

    An alternative to plugging into an existing installation is to build a complete GeoServer war that includes the custom hello plugin. To achieve this a new dependency is declared from the core web/app module on the new plugin project. This requires building GeoServer from sources.

    1. Build GeoServer from sources as described here.

    2. Install the hello module as above.

    3. Edit web/app/pom.xml and add the following dependency:

      <dependency>
          <groupId>org.geoserver</groupId>
          <artifactId>hello</artifactId>
          <version>1.0</version>
      </dependency>
      
    4. Install the web/app module

    [web/app] mvn install
    

    A GeoServer war including the hello extension should now be present in the target directory.

    Note

     

    To verify the plugin was bundled properly unpack geoserver.war and inspect the contents of the WEB-INF/lib directory and ensure the hello jar is present.

    Running from Source

    During development the most convenient way to work with the extension is to run it directly from sources.

    1. Setup GeoServer in eclipse as described here.

    2. Move the hello module into the GeoServer source tree under the community root module.

    3. Edit the community/pom.xml and add a new profile:

      <profile>
        <id>hello</id>
        <modules>
          <module>hello</module>
        </modules>
      </profile>
      
    4. If not already done, edit web/app/pom.xml and add the following dependency:

      <dependency>
          <groupId>org.geoserver</groupId>
          <artifactId>hello</artifactId>
          <version>1.0</version>
      </dependency>
      
    5. From the root of the GeoServer source tree run the following maven command:

    [src] mvn -P hello eclipse:eclipse
    
    1. In eclipse import the new hello module and refresh all modules.

    2. In the web-app module run the Start.java main class to start GeoServer.

    Note

     

    Ensure that the web-app module in eclipse depends on the newly imported hello module. This can be done by inspecting the web-app module properties and ensuring the hello module is a project dependency.

    12.2 REST Services

    12.3 Web User Interface

    12.4 Wicket Development In GeoServer

    12.5 Extension Points

    12.6 WPS Services

    12.7 Testing

    12.8 Security

    12.9 App-Schema Online Tests

     

    第十三章:Release Schedule

    第十四章:Release Guide

    第十五章:Release Testing Checklist

    第十六章:Cite Test Guide

    第十七章:Translating GeoServer

    第十八章:Policies and Procedures

    第十九章:Build Windows installer

    Maven下载库出问题:link1 link2 link3 link4

    发现主要都是geotools。。。

     IDEA自带的Maven:https://blog.csdn.net/qq_19312397/article/details/106175632

    maven 中心源地址更新为 https 的问题:https://www.v2ex.com/t/639199   直接重下github上的geoserver,重新加载pom.xml就可以了

     IDEA geotools quickstart:http://docs.geotools.org/latest/userguide/tutorial/quickstart/intellij.html

     导入geotools相关依赖有时候报红,或者下载不全,需要改settings.xml文件:link

     Maven私服Nexus安装和使用:https://blog.csdn.net/qq_33248299/article/details/83386184

    idea maven sync Cannot resolve xxx 的解决方案:https://www.cnblogs.com/kinome/p/11391885.html

     

     托管平台:https://repo.osgeo.org/#browse/browse:release

    Could not find artifact com.google.errorprone:javac:pom:9+181-r4173-1 in osgeo-releases (https://repo.osgeo.org/repository/release/):mvn

    java.lang.NoSuchMethodError 终极解决方法:https://blog.csdn.net/qq_28675967/article/details/90579636 还是jar包不全的原因,主要是errorprone,如何自己生成jar包

     为什么别人没有遇到errorprone的问题:https://blog.csdn.net/u010608964/article/details/83719105  如何在pom.xml里配置errorprone的文件下载地址   或者自己下载maven重新试试 肯定是缺少了关联文件

     https://blog.csdn.net/xiaojia1100/article/details/70238240    

    可能是errorprone和java8不匹配(errorprone2.0以上需要Java9以上 java11):https://www.icode9.com/content-1-262066.html

    errorprone idea插件设置:https://blog.csdn.net/xiaojia1100/article/details/70238240

    IDEA 程序包不存在,找不到符号但是明明存在对应的jar包 的解决方案:https://blog.csdn.net/cxz7456/article/details/106132805/

    https://www.cnblogs.com/yswyzh/p/9808878.html

    GeoServer简介:Geoserver是基于spring mvc框架的服务器应用程序 geoserver2.13.0:http://geoserver.org/release/2.13.0/

  • 相关阅读:
    3. 操作系统优化
    Linux 目录
    2. 系统的目录结构
    1. 系统管理以及操作命令
    7. 流程控制之for循环
    6. 流程控制之while循环
    我的第一篇博客园随笔
    H5自带进度条&滑块
    DIV水平方向居中的几种方法
    vue入门--简单嵌套路由的一个路径小问题
  • 原文地址:https://www.cnblogs.com/2008nmj/p/13725373.html
Copyright © 2011-2022 走看看