Using Maven to Develop GridDB Applications


In this post, we will go through common steps involved in configuring Maven for a project that uses the GridDB Java API.
This blog assumes you have both GridDB and Maven installed correctly. If you do not yet have GridDB installed, you can refer to the beginning portion of this blog. Maven can be installed using this method.

Installing the GridDB Jar

First, you need to install gridstore.jar into your local Maven repository.

mvn install:install-file -Dfile=/usr/share/java/gridstore.jar \
    -DartifactId=gs -Dversion=4.0 -Dpackaging=jar

Create Your Project

For this sample project we’ll use the which is used in many of the GridDB blogs and tutorials. We will create the Maven POM file, “pom.xml” which configures the project. If you’re familiar with Maven POM files already, the only GridDB specific portion is adding the dependency:


The full pom.xml will look like this:

<project xmlns="" xmlns:xsi=""

Your POM file should now be set up correctly to run Maven and should be placed in a separate directory that we will use to organize the project such as “mavenSample”. Inside the base level directory there will be the pom that was just created and you will need to create a new directory structure and download

$ mkdir -p src/main/java/net/griddb/sample/gsSample/
$ curl > \

Now you need to edit src/main/java/net/griddb/sample/gsSample/ changing package gsSample; to package net.griddb.sample.gsSample;

Build and Execute

Now, to run maven, simply navigate to your mavenGridDBJavaConnectorTest folder and run the following commands:

mvn clean package
mvn package exec:java -Dexec.mainClass="net.griddb.sample.gsSample.Sample1" -Dexec.args=" 31999 defaultCluster admin admin"

If the build and execution was successful, the following should be displayed:

Person:  name=name02 status=false count=2 lob=[65, 66, 67, 68, 69, 70, 71, 72, 73, 74]

Once confirmed, we are finished. You should now be able to use Maven to build and run your GridDB projects.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.