cmc
cmc

Reputation: 1107

Building and packaging neo4j server-plugins

I've tried to build the example GetAll server-plugin in the docs but without success.

My attempt:

$ mkdir getall
$ cd getall
$ wget https://raw.githubusercontent.com/neo4j/neo4j/2.1.7/community/server-examples/src/main/java/org/neo4j/examples/server/plugins/GetAll.java
$ mkdir -p META-INF/services/
$ echo "org.neo4j.examples.server.plugins.GetAll" > META-INF/services/org.neo4j.server.plugins.ServerPlugin
$ javac -classpath /path/to/server-api-2.1.7.jar:/path/to/neo4j-kernel-2.1.7.jar GetAll.java
$ jar -cvf getall.jar .
$ mv getall.jar /path/to/neo4j/libexec/plugins/

I then try curl -X GET http://localhost:7474/db/data/ and receive a blank extensions section (missing even plugins I know are installed and work, like load2neo and GraphAware.WarmUp, I assume they don't register themselves here).

How do I go about building simple server plugins?

Upvotes: 0

Views: 105

Answers (1)

cmc
cmc

Reputation: 1107

I built the same plugin with maven and compared jar files. Turns out one needs to put the .class files in the correct folder hierarchy for neo to find them.

So org.neo4j.examples.server.plugins.GetAll -> org/neo4j/examples/server/plugins/GetAll.class

Or, one could just get rid of all that guff by omitting the package declaration in GetAll.java and changing the META-INF file to read GetAll. The namespaces don't seem to help that much anyway (org.neo4j.examples.blah still prevents access to com.somenamespace.blah (if both are installed)).

Upvotes: 1

Related Questions