Neo4j的POM文件应该包含哪些内容?

时间:2016-07-22 14:14:39

标签: java maven intellij-idea neo4j pom.xml

我似乎无法识别导入(导入org.neo4j.driver.v1。*;)。它无法解决neo4j。

我认为这与我的pom.xml文件有关,我完全不确定如何设置。

现在我有:

<?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>

这也没有完全奏效。它是在之前,但我有点乱了。如果有人能帮助我走上正确的轨道,那将非常感激!

谢谢!

2 个答案:

答案 0 :(得分:2)

您错过了<dependencies></dependencies>标记。还有一些描述标签。

在此处选择您要使用的版本:https://maven-repository.com/search?q=neo4j

并将其添加到您的pom.xml

看起来应该是这样的:

<?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>

答案 1 :(得分:1)

来自Maven全球回购:

<project>
...
    <dependencies>
        <dependency>
            <groupId>org.neo4j.driver</groupId>
            <artifactId>neo4j-java-driver</artifactId>
            <version>1.1.0-M01</version>
        </dependency>
    </dependencies>
</project>

https://mvnrepository.com/artifact/org.neo4j.driver/neo4j-java-driver