Setting up a plugin project

You can set up a project for extending Neo4j with a user-defined procedure, build the project, and deploy the procedure to a Neo4j instance. The same steps can be used for user-defined functions.

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.


Implement custom seed providers

The Seed from URI feature provides the ability to dynamically discover additional seed provider implementations from the class path.

Seed providers should be implemented in Java and this guide provides instructions on how to do this using Maven as the build tool.

Set up a Maven project

Include this dependency to build against the Neo4j-provided API:


Implement Java class

import com.neo4j.dbms.seeding.ParsedSeedProviderConfig;
import com.neo4j.dbms.seeding.SeedProvider;

public class CustomSeedProvider extends SeedProvider {

	public boolean matches(String uri) {
   		// return true if uri is supported by this
      // provider

public Path download(
     	String uri,
      Optional<String> credentials,
      Optional<String> config,
      Path destinationFolder ) throws Exception {
      // This method should obtain the downloaded in an
      // implementation specific way and copy it to a
      // file within the destinationFolder directory.

To implement the custom seed provider, you must implement two methods. One method to match the URIs it can manage and one to download backups or dumps from the given URI.

Typically, the match method uses the URI scheme (the part specified before the first colon) to determine whether it can support the given URI or not. For example, file, http, https etc.

The download method should implement a scheme-specific way to obtain the backup or dump and place it into a file in the supplied destination folder. It should then return the path of the created file.

Both credentials and configurations are passed through from options specified in the CREATE DATABASE command. ParsedSeedProviderConfig provides a convenient way to parse and access the comma-separated configuration string.


Build a jar file from Maven and place this onto the Neo4j classpath.

The jar must include a META-INF file to enable discovery of the providers with the path:


It should be a plain text file with one line for each provider contained within the jar, the line should contain the fully qualified name of the provider class.

If you need assistance with custom seed providers, please contact Professional Services.