2 Maven Quickstart


Building and Running GeoServer with Maven.In this Quickstart you will:

  • Check out the GeoServer source code from the subversion repository.
  • Build GeoServer Modules
  • Setup a GeoServer Configuration
  • Run GeoServer with Jetty

Source Code

  1. Ensure you have Subversion properly setup. Instructions here
  2. Create a directory (with no spaces in the path) for the source, such as:
    C:\geoserver_dev
  3. Open up a terminal and navigate to a location where you want to checkout the code, the following examples are from UNIX and assume /home/username
  4. Execute the following command:
    [/home/username]% svn checkout https://svn.codehaus.org/geoserver/trunk/geoserver
    Note: Geoserver will not build/run properly if it is in a folder with spaces in the name (eg: "Documents and Settings") so try to keep the folder names in the path for your source files space-free.

Building

The term building refers to installing the geoserver modules into your local maven repository. Maven build commands are executed from the command line.

If you're compiling GeoServer in a headless enviroment (e.g., a remote Linux server that you're accessing using an SSH terminal) you'll get "headless exceptions" unless you either:

  • set the envorinment variable java.awt.headless to true, that is "export java.awt.headless=true"
  • add -Djava.awt.headless=true to all the maven commands suggested for building and running GeoServer

From the root of the geoserver source tree:

[/home/username/geoserver]% mvn install

Running the Server

By default the web module is built with the "minimal" configuration which located directly in the web module itself. This configuration is empty and not much to look at

Alternate configurations are located in the subversion repository .

 Getting a configuration directory

Let's check out a configuration now:

[/home/username]% cd ..
[/home/username]% svn checkout https://svn.codehaus.org/geoserver/trunk/configuration/release release_conf

This will download a data catalog (XML file), some Shapefiles and SLDs (XML files that describe styles) into the directory release_conf

 Running with Jetty

Maven comes with built-in support for Jetty via plug-in.

To run GeoServer with Jetty:

  1. Build Geoserver
  2. Check out a configuration
  3. Change directory to the root of the web module
  4. Execute the following maven comand, be sure to set /home/username/release_conf to wherever you checked out the configuration:
[/home/username/geoserver/web]% mvn jetty:run -DGEOSERVER_DATA_DIR=/home/username/release_conf

Open up your browser

Congratulations!

Offline Mode

To prevent maven from trying to download a new version of the Jetty plug-in you can run the above command in offline mode:

[/home/username/geoserver/web]% mvn -o jetty:run

For more information check out Maven Build Reference.

Comments

man_kills_everything@hotmail.com says:

It seems that it won't connect to mortbay.org when trying to install.  Is this likely to be a temporary problem (the website just happens to be down) or has it been moved?

View Attachments (0) Info