无法找到神器休眠

时间:2012-04-02 12:22:15

标签: hibernate java-ee maven

这是我的 pom.xml

<repositories>
    <repository>
        <url>http://download.java.net/maven/2/</url>
        <id>hibernate-support</id>
        <layout>default</layout>
        <name>Repository for library Library[hibernate-support]</name>
    </repository>
</repositories>

<dependencies>

<!-- MySQL database driver -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.9</version>
    </dependency>

<!-- Spring framework --> 
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring</artifactId>
        <version>2.5.6</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>3.1.1.RELEASE</version>
    </dependency>

<!-- Hibernate core -->
    <dependency>
    <groupId>hibernate</groupId>
    <artifactId>hibernate3</artifactId>
    <version>3.2.3.GA</version>
</dependency>


<!-- Hibernate core library dependecy start -->
    <dependency>
        <groupId>dom4j</groupId>
        <artifactId>dom4j</artifactId>
        <version>1.6.1</version>
    </dependency>

    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.1.1</version>
    </dependency>

    <dependency>
        <groupId>commons-collections</groupId>
        <artifactId>commons-collections</artifactId>
        <version>3.2.1</version>
    </dependency>

    <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib</artifactId>
        <version>2.2</version>
    </dependency>
<!-- Hibernate core library dependecy end -->

<!-- Hibernate query library dependecy start -->
    <dependency>
        <groupId>antlr</groupId>
        <artifactId>antlr</artifactId>
        <version>2.7.7</version>
    </dependency>


<!-- For Servlet Container like Tomcat -->
<!-- http://download.java.net/maven/2 -->
    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-api</artifactId>
        <version>2.1.7</version>
    </dependency>

    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-impl</artifactId>
        <version>2.1.7</version>
    </dependency>

<!-- http://repo1.maven.org/maven2/ -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
    </dependency>

    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.1</version>
    </dependency>

</dependencies>

<build>
    <finalName>JavaServerFaces</finalName>

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.1</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
    </plugins>
</build>
<properties>
    <netbeans.hint.deploy.server>Tomcat</netbeans.hint.deploy.server>
</properties>

但我有 ERROR

  

无法在项目JavaServerFaces上执行目标:无法解决项目com.mkyong.common的依赖关系:JavaServerFaces:war:1.0-SNAPSHOT:无法找到工件hibernate:hibernate3:jar:3.2.3.GA in hibernate-support (http://download.java.net/maven/2/) - &gt; [帮助1]

你能告诉我哪里错了!!

5 个答案:

答案 0 :(得分:14)

hibernate依赖似乎是错误的(artifactId)。

尝试

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate</artifactId>
    <version>3.2.3.ga</version>
</dependency>

请参阅http://mvnrepository.com/artifact/org.hibernate/hibernate/3.2.3.ga

答案 1 :(得分:0)

你能尝试以下代替你所包含的Hibernate吗?

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate</artifactId>
    <version>3.2.3.ga</version>
</dependency>

您正在使用的那个具有旧的且不再有效的组和工件ID。

答案 2 :(得分:0)

Could not find artifact hibernate:hibernate3:jar:3.2.3.GA in hibernate-support (http://download.java.net/maven/2/)

您有错误的外部存储库或错误的hinbernate依赖关系定义。

答案 3 :(得分:0)

即使在添加了hibernate 3.2.3.ga之后,您也可能会出现以下错误 &#34;缺少工件javax.transaction:jta:jar:1.0.1B&#34;

修复此问题将添加jta依赖项,如下所示 &#34; javax.transactionjta1.1&#34;

答案 4 :(得分:0)

如果发生此类错误(“缺少构件org.hibernate:hibernate:jar:3.2.3.ga”),请查看最新的hibernate版本并进行更新。

以上答案是正确的,但只能使用一种特定版本,但以后将无法使用。

下面的链接将具有休眠版本,并根据您的情况进行选择

https://mvnrepository.com/artifact/org.hibernate/hibernate-core/5.3.1.Final