Maven Dependency Nightmare

时间:2016-02-06 06:00:10

标签: java hibernate maven dependencies pom.xml

我是编程的新手,正在通过Hibernate教程(包括使用Maven)。在我尝试使用教程中推荐的命令编译或启动我的HSQLDB服务器之前,一切似乎都进展顺利:

mvn exec:java -Dexec.mainClass =“org.hsqldb.Server”-Dexec.args =“ - database.0 file:target / data / tutorial”

那时我得到了一个构建失败,我将在下面包括我的pom。它似乎告诉我,依赖关系缺少poms,但我不知道如何纠正这个问题。任何帮助将不胜感激,以便我可以继续我的学习经验。 enter image description here

<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>org.hibernate.tutorials</groupId>
<artifactId>hibernate-tutorial</artifactId>
<version>1.0.0-snapshot</version>
<name>First Hibernate Tutorial</name>

<build>
     <!-- we dont want the version to be part of the generated war file name -->
     <finalName>${project.artifactId}</finalName>
</build>

<dependencies>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>5.0.7.final</version>
    </dependency>

    <!-- Because this is a web app, we also have a dependency on the servlet api. -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>3.1.0</version>
    </dependency>

    <!-- Hibernate uses slf4j for logging, for our purposes here use the simple backend -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.7.14</version>
    </dependency>

    <!-- Hibernate gives you a choice of bytecode providers between cglib and javassist -->
    <dependency>
        <groupId>javassist</groupId>
        <artifactId>javassist</artifactId>
        <version>3.18.1-GA</version>
    </dependency>
</dependencies>

1 个答案:

答案 0 :(得分:3)

使用search.maven.com,似乎Hibernate依赖项名称为hibernate-core-5.0.7.Final。也就是说,F中的资本Final。所以试试

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-core</artifactId>
    <version>5.0.7.Final</version>
</dependency>

代替