GeoNetwork From Scratch I : The Phantom Catalog

This post was originally posted on the blog of a former company. But since they have decided to violate my authorship rights, here is a copy of it.

GeoNetwork, your friendly spatial catalog, never has been an easy software to deal with. But specially after the 3.0 version release, many things have changed. On this series of posts we will try to help new developers start with it.

GeoNetwork logo
The yoga man

The source code is available on a public repository on Github. This means that you can clone, fork and propose pushes of your custom changes. If you are not familiar with repositories of code or git, you should check this quick manual.

Maven and Java

It is built using mavenversion 3+. Therefore, it is written on Java and requires version 7 or more. Can be run both with OpenJDK or the Oracle version.You will need git and maven installed on your local machine to work. There are several ways to install this on your local machine; for example if you have a Debian based OS (like Ubuntu), you can install them with just this command:

sudo apt-get install maven git

Make sure you installed maven version 3!!

$ mvn –version
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T18:37:52+01:00)
Maven home: ….

Remember that this will also install java on your system. You can check that the version is the right one with the following command:

java -version

So, the very first step once you have your environment set up is clone the repository on your local machine. That can be done on the command line using the following command inside an empty folder where the source code will be populated:

cd yourEmptyFolder
git clone https://github.com/geonetwork/core-geonetwork.git
git submodule init
git submodule update

As you can see, all the source code shown on github is also available on your local machine now.

Internal Structure of GeoNetwork

The source code is split on several smaller maven projects. To run it, you have to build all of them and run the project named “web“.

If you are familiar to maven, you will probably have guessed that you have to run a package install command on the root folder of the source code. But if you try that, maven will warn you that for building it you need more memory than the default memory provided to maven.

So, you will have to export the maven options to increase the memory like this:

export MAVEN_OPTS="-Xmx512M -XX:MaxPermSize=256M"

At this point we are not interested in running the tests, so you can skip them using the parameter “-DskipTests”:

mvn package install -DskipTests

At the end of this build (which can take long, depending on your network connection, as it has many third party libraries), you will see something like this:

------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:19 min (Wall Clock)
[INFO] Finished at: 2015-07-17T10:36:43+01:00
[INFO] Final Memory: 232M/441M
[INFO] ------------------------------------------------------------------------

This will generate a war file you can use in any Java Application Container (server) like Tomcat on web/target/geonetwork.war

Running GeoNetwork

Congratulations! You are ready to run it. To do this, just go to the web folder and run jetty in there:

cd web; mvn jetty:run

After jetty starts, you can see your running spatial catalog by opening a browser and enter to http://localhost:8080/geonetwork

Continue in Attack of the IDEs

Autor: María Arias de Reyna Domínguez

This is the blog of María Arias de Reyna.

Un comentario en “GeoNetwork From Scratch I : The Phantom Catalog”

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

es_ESEspañol