Jaromando Jaromando - 4 months ago 15
Java Question

What should be in the POM file for Neo4j?

I cannot seem to get the import (import org.neo4j.driver.v1.*;) to be recognized. It cannot resolve neo4j.

I believe it has to do with my pom.xml file which I am completely unsure of how to set up.

Right now I have:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<dependency>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver</artifactId>
<version>1.0.3</version>
</dependency>

<build>
<defaultGoal>install</defaultGoal>
</build>


</project>


This is not fully working as well. It was before, but I messed with it a little to much. If anyone can help me get on the right track it would be much appreciated!

Thanks!

Answer

You're missing the <dependencies></dependencies> tag. And a couple of description tags too.

Pick the version you want to use here: https://maven-repository.com/search?q=neo4j

And add it to your pom.xml

It should look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0      
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.example</groupId> // You're Missing this
<artifactId>demo</artifactId> // You're Missing this
<version>0.0.1-SNAPSHOT</version> // You're Missing this
<packaging>jar</packaging> // You're Missing this

<name>demo</name> // You're Missing this
<description>Demo project</description> // You're Missing this

<dependencies> // You're Missing this
    <dependency>
        <groupId>org.neo4j.driver</groupId>
        <artifactId>neo4j-java-driver</artifactId>
        <version>1.0.3</version>
    </dependency>
</dependencies> // You're Missing this

<build>
    <defaultGoal>install</defaultGoal>
</build>

Comments