构建和打包neo4j服务器插件

时间:2015-03-03 14:27:31

标签: neo4j

我尝试在the docs中构建示例GetAll服务器插件,但没有成功。

我的尝试:

$ 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/

然后我尝试curl -X GET http://localhost:7474/db/data/并收到一个空白的extensions部分(我知道安装和工作的插件都没有,比如load2neo和GraphAware.WarmUp,我假设他们没有在这里注册)。

如何构建简单的服务器插件?

1 个答案:

答案 0 :(得分:1)

我使用maven构建了相同的插件并比较了jar文件。事实证明,需要将.class文件放在正确的文件夹层次结构中以便neo找到它们。

所以org.neo4j.examples.server.plugins.GetAll - > org/neo4j/examples/server/plugins/GetAll.class

或者,可以通过省略GetAll.java中的package声明并将META-INF文件更改为读取GetAll来摆脱所有这些问题。无论如何,命名空间似乎没有那么大的帮助(org.neo4j.examples.blah仍然阻止访问com.somenamespace.blah(如果两者都已安装)。)