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 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.21.x
   2.22.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.22.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 Java, Build Path, Classpath 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 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.

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