Setting up a plugin project

This section describes how to prepare a project for writing user-defined procedures and functions in Neo4j. The following shows the steps to create and deploy a new procedure.

The example described in this section is available on GitHub (neo4j-examples/neo4j-procedure-template).

Set up a project with Maven

A project can be set up in any way that allows for compiling a procedure and producing a jar file.

Below are the main parts of the example configuration, using the Maven build system.

Excerpts from the Maven pom.xml file


  <name>Neo4j Procedure Template</name>
  <description>A template project for building a Neo4j Procedure</description>


Build dependencies

Add a dependency section that includes the procedure and function APIs, which procedures and functions use at runtime.

The scope is set to provided, because once the procedure is deployed to a Neo4j instance, this dependency is provided by Neo4j. If non-Neo4j dependencies are added to the project, their scope should normally be compile.


Add dependencies that are necessary for testing the procedure.

Neo4j Harness, a utility that allows for starting a lightweight Neo4j instance. It is used to start Neo4j with a specific procedure or function deployed, which greatly simplifies testing.

Neo4j Java Driver, used to send Cypher statements that call the procedure or function.

JUnit, a common Java test framework.




Build steps

The steps that Maven will go through to build the project.

The goal is first to compile the source, then to package it in a jar that can be deployed to a Neo4j instance.

The Maven Shade plugin is used to package the compiled procedure. It also includes all dependencies in the package, unless the dependency scope is set to test or provided.

Once the procedure has been deployed to the plugins directory of each Neo4j instance and the instances have restarted, the procedure is available for use.