【问题标题】:Could not find artifact hibernate找不到工件休眠
【发布时间】:2012-04-16 02:35:42
【问题描述】:

这是我的 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>

但我有这个错误

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

你能告诉我哪里错了吗!!

【问题讨论】:

    标签: hibernate jakarta-ee maven


    【解决方案1】:

    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

    【讨论】:

    • @ccheneson 你和 Stackoverflow 是像我们这样的软件工程师的救星
    【解决方案2】:

    您可以尝试以下方法而不是您包含的 Hibernate 吗?

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

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

    【讨论】:

      【解决方案3】:
      Could not find artifact hibernate:hibernate3:jar:3.2.3.GA in hibernate-support (http://download.java.net/maven/2/)
      

      要么你有错误的外部存储库,要么有错误的 hinbernate 依赖定义。

      【讨论】:

        【解决方案4】:

        即使在添加了 hibernate 3.2.3.ga 之后,您也可能会收到以下错误 “缺少工件 javax.transaction:jta:jar:1.0.1B”

        对此的修复将是添加 jta 依赖项,如下所示 “javax.transactionjta1.1”

        【讨论】:

          【解决方案5】:

          如果出现这些 ("Missing artifact org.hibernate:hibernate:jar:3.2.3.ga") 类型的错误,请查看 hibernate 的最新版本并进行更新。

          上面的答案是正确的,但是坚持使用一个特定的版本,但将来不会起作用。

          下面的链接将有hibernate的版本,并根据你的选择

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

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2014-05-03
            • 2014-11-28
            • 2020-11-18
            • 2021-09-08
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多