Development is supported on Ubuntu and OSX. It will probably work on other Linuxes. Pull requests welcomed for other platforms.
- install GNU Make (>=4.0)
- install the Docker Toolbox. See: https://docs.docker.com/install/
- install the Docker Toolbox. See https://docs.docker.com/install/
The build will create two images (one for Enterprise and one for Community) for a single version of Neo4j.
The make script will automatically download the source files needed to build the images. You just need to specify the full Neo4j version including major, minor and patch numbers. For example:
NEO4JVERSION=3.5.11 make clean build
If you want to build an alpha/beta release, this will still work:
NEO4JVERSION=3.5.0-alpha01 make clean build
When the make script is complete, the image name will be written to file in tmp/.image-id-community
and tmp/.image-id-enterprise
:
$ cat tmp/.image-id-community
test/19564
$ cat tmp/.image-id-enterprise
test/13909
From Neo4j 4.4.0 onwards, the Neo4j image should be buildable on any architecture using the same build commands as Building the Image.
For earlier versions of Neo4j, you may need to set the variable NEO4J_BASE_IMAGE
to your architecture specific version of openjdk:11-jdk-slim
(or openjdk:8-jdk-slim
for versions before 4.0.0).
Like with amd64
images, you must still specify the full Neo4j version including major, minor and patch numbers. For example:
NEO4J_BASE_IMAGE=arm64v8/openjdk:11-jdk-slim
NEO4JVERSION=4.3.7 make clean build
The make script cannot automatically download unreleased source files, so you need to manually download them before building the images.
- Assuming you cloned this repository to
$NEO4J_DOCKER_ROOT
, download the community and enterprise unix tar.gz files and copy them to$NEO4J_DOCKER_ROOT/in
. - Run the make script setting
NEO4JVERSION
to the version number in the files downloaded into thein/
folder.
For example:
$ cd $NEO4J_DOCKER_ROOT
$ ls $NEO4J_DOCKER_ROOT/in
neo4j-community-4.0.0-alpha05-unix.tar.gz neo4j-enterprise-4.0.0-alpha05-unix.tar.gz
$ NEO4JVERSION=4.0.0-alpha05 make clean build
The tests are written in java, and require Maven plus jdk 11 for Neo4j version 4.0 onwards or jdk 8 for earlier Neo4j versions.
The tests require some information about the image before they can test it. These can be passed as an environment variable or a command line parameter when invoking maven:
Env Variable | Maven parameter | Description |
---|---|---|
NEO4JVERSION |
-Dversion |
the Neo4j version of the image |
NEO4J_IMAGE |
-Dimage |
the tag of the image to test |
NEO4J_EDITION |
-Dedition |
Either community or enterprise depending on the image. |
Tests in this module are using testcontainers. The framework expects you to have docker available on your system. And there are some issues like described here: testcontainers/testcontainers-java#2088
TLDR on what you need to do to be able to use podman:
-
Make sure you have podman service running. For example:
podman system service --time=0 unix:///tmp/podman.sock
-
Add those environment variables:
DOCKER_HOST=unix:///tmp/podman.sock;
TESTCONTAINERS_RYUK_DISABLED=true;
TESTCONTAINERS_CHECKS_DISABLE=true
The Makefile can run the entire test suite.
- Make sure
java --version
is java 11 or java 8 as necessary. NEO4JVERSION=<VERSION> make test
This is a make target that will run these commands:
mvn test -Dimage=$(cat tmp/.image-id-community) -Dedition=community -Dversion=${NEO4JVERSION}
mvn test -Dimage=$(cat tmp/.image-id-enterprise) -Dedition=enterprise -Dversion=${NEO4JVERSION}
-
Make sure the project SDK is java 17, 11 or 8 as necessary.
-
Edit the pom.xml file to replace
${env.NEO4JVERSION}
with theNEO4JVERSION
you used to build the image. (Yes this is terrible, and we need to think of an alternative to this).For example:
<neo4j.version>${env.NEO4JVERSION}</neo4j.version>
becomes
<neo4j.version>4.0.0-alpha05</neo4j.version>
-
Install the EnvFile Intellij plugin.
-
Under Run Configurations edit the Template JUnit configuration:
- Select the "EnvFile" tab
- Make sure "Enable EnvFile" is checked.
- Click the
+
then click to add a.env
file. - In the file selection box select
./tmp/devenv-enterprise.env
or./tmp/devenv-community.env
depending on which one you want to test. If you do not have the./tmp
directory, build the docker image and it will be created. - Rebuilding the Neo4j image will regenerate the
.env
files, so you don't need to worry about keeping the environment up to date.
- Clone the Neo4j github repository and checkout the branch you want.
- Make sure
java --version
returns java 11 if you're building Neo4j 4.0+, or java 8 if building an earlier branch. - Run
mvn install
plus whatever maven build flags you like. This should install the latest neo4j jars into the maven cache. - Follow instructions for running tests in Intellij,
use the
NEO4JVERSION
that is in the pom file of your Neo4j repository clone.
This can happen if you switch from java 8 to java 11 and then try to rebuild the tests in Intellij.
Check that the java.version
property in the pom.xml file is set to 11 instead of 1.8.
DO NOT commit this set to 11 (yes this is a terrible solution).