Eclipse M2 Quickstart

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

Choose main for the latest development.:

% git checkout main

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.

Eclipse Maven builder

The maven build supplied with eclipse works with the pom.xml files, however it does recognize some of our custom build steps:

  1. Go to Preferences and navigate to Maven ‣ Errors/Warning

  2. Change the Plugin execution not covered by lifecycle configuration to Warning.

../_images/m2_warning.png

java-cc-maven-plugin

The Eclipse M2 builder does recognize this plugin, build once on the command line first:

  1. Navigate to :file:`src/wcs1_1`.

  2. Compile, to force the code to be generated:

    mvn compile
    
    [INFO] --- javacc-maven-plugin:2.3:jjtree (jjtree) @ gs-wcs1_1 ---
    Java Compiler Compiler Version 4.0 (Tree Builder)
    (type "jjtree" with no arguments for help)
    "src/wcs1_1/target/jjtree/org/geoserver/wcs/kvp/rangesubset/ASTFieldId.java" does not exist.  Will create one.
    ...
    Annotated grammar generated successfully in src/wcs1_1/target/jjtree/org/geoserver/wcs/kvp/rangesubset/rangeset.jj
    [INFO]
    [INFO] --- javacc-maven-plugin:2.3:javacc (javacc) @ gs-wcs1_1 ---
    Java Compiler Compiler Version 4.0 (Parser Generator)
    (type "javacc" with no arguments for help)
    Reading from file src/wcs1_1/target/jjtree/org/geoserver/wcs/kvp/rangesubset/rangeset.jj . . .
    File "TokenMgrError.java" does not exist.  Will create one.
    File "ParseException.java" does not exist.  Will create one.
    ...
    Parser generated successfully.
    [INFO]
    
    [INFO] --- fmt-maven-plugin:2.4.0:format (default) @ gs-wcs1_1 ---
    [debug] Using AOSP style
    [INFO] Processed 47 files (0 reformatted).
    [INFO]
    

Import modules into Eclipse

  1. Use File ‣ Import to open the Import wizard. Select Maven ‣ Existing Maven Projects import wizard, and Next.

  2. Define the Root Directory by browsing to the GeoServer src folder.

  3. Open Advanced options:

    • Profiles: release

    • Name template: [groupId].[artifactId]

    ../_images/m2_import.png
  4. Press Finish to start import.

    During import use Resolve Later, exclude lifecycle mapping.

    ../_images/m2_plugin_connectors.png

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 as, Java 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.

Access GeoServer front page