Hibernate 的 Maven 依赖项

发布于 2024-12-25 15:16:51 字数 5673 浏览 0 评论 0原文

我需要将 Hibernate 与 Spring 结合使用,我试图找出要使用的 Maven 依赖项,这不会太困难,但不知何故我无法完成它。

在我正在开发的玩具应用程序中,我需要实现一些我在一两年前开发的用例,我使用 Hiebrnate 3.3.2.GA 和 Hibernate 注释 3.4.0.GA。所以我只需要与我的项目中包含的相同的 jar,而不使用 Maven。因此,我在我的 pom.xml 文件中添加了以下内容:

<dependencies>
        ...
        <dependency>
           <groupId>org.hibernate</groupId>
           <artifactId>hibernate-core</artifactId>
           <version>3.3.2.GA</version>
        </dependency>
        <dependency>
           <groupId>org.hibernate</groupId>
           <artifactId>hibernate-annotations</artifactId>
           <version>3.4.0.GA</version>
        </dependency>
        <dependency>
           <groupId>org.hibernate</groupId>
           <artifactId>hibernate-commons-annotations</artifactId>
           <version>3.3.0.GA</version>
        </dependency>
        <dependency>
           <groupId>org.hibernate</groupId>
           <artifactId>hibernate-entitymanager</artifactId>
           <version>3.4.0.GA</version>
        </dependency> 
         <dependency>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
          <version>1.2.15</version>
        </dependency>
       ... 
</dependencies>
    <repositories>  
        ...
        <repository>
            <id>JBoss</id>
            <name>JBoss Repsitory</name>
            <layout>default</layout>
            <url>http://repository.jboss.org/maven2</url>
        </repository>
        ...
    </repositories> 

我得到的结果是:

Multiple annotations found at this line:
    - Missing artifact log4j:log4j:jar:1.2.15:compile
    - Missing artifact com.mortennobel:java-image-scaling:jar:0.8.5:compile
    - Missing artifact org.hibernate:hibernate-core:jar:3.3.2.GA:compile
    - Missing artifact com.jhlabs:filters:jar:2.0.235:compile
    - Missing artifact net.java.dev.rome:rome:jar:1.0.0:compile
    - Missing artifact javassist:javassist:jar:3.4.GA:compile
    - Missing artifact jdom:jdom:jar:1.0:compile
    - Missing artifact com.sun.jdmk:jmxtools:jar:1.2.1:compile
    - Missing artifact org.springframework:spring-web:jar:3.1.0.RELEASE:compile
    - Missing artifact org.slf4j:jcl-over-slf4j:jar:1.6.1:runtime
    - Missing artifact org.hibernate:hibernate-commons-annotations:jar:3.1.0.GA:compile
    - Missing artifact commons-io:commons-io:jar:2.0.1:compile
    - Failed to read artifact descriptor for org.hibernate:hibernate-commons-
     annotations:jar:3.3.0.GA
    - Missing artifact org.hibernate:hibernate-entitymanager:jar:3.4.0.GA:compile
    - Missing artifact org.springframework:spring-beans:jar:3.1.0.RELEASE:compile
    - Missing artifact javax.mail:mail:jar:1.4:compile
    - Missing artifact org.slf4j:slf4j-api:jar:1.6.1:compile
    - Missing artifact org.hibernate:hibernate-validator:jar:4.1.0.Final:compile
    - Missing artifact javax.validation:validation-api:jar:1.0.0.GA:compile
    - Missing artifact commons-dbcp:commons-dbcp:jar:1.4:compile
    - Missing artifact org.codehaus.jackson:jackson-mapper-asl:jar:1.8.1:compile
    - Missing artifact org.slf4j:slf4j-log4j12:jar:1.6.1:runtime
    - Missing artifact javax.jms:jms:jar:1.1:compile
    - Missing artifact javax.transaction:jta:jar:1.1:compile
    - Missing artifact joda-time:joda-time:jar:1.6.2:compile
    - Missing artifact javax.servlet.jsp:jsp-api:jar:2.1:provided
    - Missing artifact javax.activation:activation:jar:1.1:compile
    - Missing artifact javax.servlet.jsp.jstl:jstl-api:jar:1.2:compile
    - Missing artifact org.hibernate:hibernate-annotations:jar:3.4.0.GA:compile
    - Missing artifact org.springframework:spring-expression:jar:3.1.0.RELEASE:compile
    - Missing artifact junit:junit:jar:4.8:test
    - Missing artifact org.springframework:spring-core:jar:3.1.0.RELEASE:compile
    - Missing artifact org.springframework:spring-asm:jar:3.1.0.RELEASE:compile
    - Missing artifact javax.servlet:servlet-api:jar:2.5:provided
    - Missing artifact com.sun.jmx:jmxri:jar:1.2.1:compile
    - Missing artifact org.springframework:spring-webmvc:jar:3.1.0.RELEASE:compile
    - Missing artifact org.glassfish.web:jstl-impl:jar:1.2:compile
    - Missing artifact org.codehaus.jackson:jackson-core-asl:jar:1.8.1:compile
    - Missing artifact org.aspectj:aspectjrt:jar:1.6.10:compile
    - Missing artifact javax.annotation:jsr250-api:jar:1.0:compile
    - Missing artifact aopalliance:aopalliance:jar:1.0:compile
    - Missing artifact commons-pool:commons-pool:jar:1.5.4:compile
    - Missing artifact org.springframework:spring-context-support:jar:
     3.1.0.RELEASE:compile
    - Missing artifact commons-collections:commons-collections:jar:3.1:compile
    - Missing artifact commons-fileupload:commons-fileupload:jar:1.2.2:compile
    - Missing artifact mysql:mysql-connector-java:jar:5.1.15:compile
    - Missing artifact org.springframework:spring-aop:jar:3.1.0.RELEASE:compile
    - Missing artifact org.hibernate:ejb3-persistence:jar:1.0.2.GA:compile
    - Missing artifact antlr:antlr:jar:2.7.6:compile
    - Missing artifact org.springframework:spring-context:jar:3.1.0.RELEASE:compile
    - Missing artifact xml-apis:xml-apis:jar:1.0.b2:compile
    - Missing artifact dom4j:dom4j:jar:1.6.1:compile
    - Missing artifact javax.inject:javax.inject:jar:1:compile

我只是无法理解为什么我会收到此错误?

有人可以帮我理解吗?

谢谢。

I need to use Hibernate with Spring for which I am trying to figure out the Maven dependencies to use and it can't be too difficult but somehow I am not able to get it done.

In toy application I am developing I need to implement a few use cases that I already developed about a year ago or two for which I used Hiebrnate 3.3.2.GA with Hibernate annotations 3.4.0.GA. So I just needed the same jars that I included in my project without using maven. So I added the following in my pom.xml file:

<dependencies>
        ...
        <dependency>
           <groupId>org.hibernate</groupId>
           <artifactId>hibernate-core</artifactId>
           <version>3.3.2.GA</version>
        </dependency>
        <dependency>
           <groupId>org.hibernate</groupId>
           <artifactId>hibernate-annotations</artifactId>
           <version>3.4.0.GA</version>
        </dependency>
        <dependency>
           <groupId>org.hibernate</groupId>
           <artifactId>hibernate-commons-annotations</artifactId>
           <version>3.3.0.GA</version>
        </dependency>
        <dependency>
           <groupId>org.hibernate</groupId>
           <artifactId>hibernate-entitymanager</artifactId>
           <version>3.4.0.GA</version>
        </dependency> 
         <dependency>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
          <version>1.2.15</version>
        </dependency>
       ... 
</dependencies>
    <repositories>  
        ...
        <repository>
            <id>JBoss</id>
            <name>JBoss Repsitory</name>
            <layout>default</layout>
            <url>http://repository.jboss.org/maven2</url>
        </repository>
        ...
    </repositories> 

And what I am getting as the result is:

Multiple annotations found at this line:
    - Missing artifact log4j:log4j:jar:1.2.15:compile
    - Missing artifact com.mortennobel:java-image-scaling:jar:0.8.5:compile
    - Missing artifact org.hibernate:hibernate-core:jar:3.3.2.GA:compile
    - Missing artifact com.jhlabs:filters:jar:2.0.235:compile
    - Missing artifact net.java.dev.rome:rome:jar:1.0.0:compile
    - Missing artifact javassist:javassist:jar:3.4.GA:compile
    - Missing artifact jdom:jdom:jar:1.0:compile
    - Missing artifact com.sun.jdmk:jmxtools:jar:1.2.1:compile
    - Missing artifact org.springframework:spring-web:jar:3.1.0.RELEASE:compile
    - Missing artifact org.slf4j:jcl-over-slf4j:jar:1.6.1:runtime
    - Missing artifact org.hibernate:hibernate-commons-annotations:jar:3.1.0.GA:compile
    - Missing artifact commons-io:commons-io:jar:2.0.1:compile
    - Failed to read artifact descriptor for org.hibernate:hibernate-commons-
     annotations:jar:3.3.0.GA
    - Missing artifact org.hibernate:hibernate-entitymanager:jar:3.4.0.GA:compile
    - Missing artifact org.springframework:spring-beans:jar:3.1.0.RELEASE:compile
    - Missing artifact javax.mail:mail:jar:1.4:compile
    - Missing artifact org.slf4j:slf4j-api:jar:1.6.1:compile
    - Missing artifact org.hibernate:hibernate-validator:jar:4.1.0.Final:compile
    - Missing artifact javax.validation:validation-api:jar:1.0.0.GA:compile
    - Missing artifact commons-dbcp:commons-dbcp:jar:1.4:compile
    - Missing artifact org.codehaus.jackson:jackson-mapper-asl:jar:1.8.1:compile
    - Missing artifact org.slf4j:slf4j-log4j12:jar:1.6.1:runtime
    - Missing artifact javax.jms:jms:jar:1.1:compile
    - Missing artifact javax.transaction:jta:jar:1.1:compile
    - Missing artifact joda-time:joda-time:jar:1.6.2:compile
    - Missing artifact javax.servlet.jsp:jsp-api:jar:2.1:provided
    - Missing artifact javax.activation:activation:jar:1.1:compile
    - Missing artifact javax.servlet.jsp.jstl:jstl-api:jar:1.2:compile
    - Missing artifact org.hibernate:hibernate-annotations:jar:3.4.0.GA:compile
    - Missing artifact org.springframework:spring-expression:jar:3.1.0.RELEASE:compile
    - Missing artifact junit:junit:jar:4.8:test
    - Missing artifact org.springframework:spring-core:jar:3.1.0.RELEASE:compile
    - Missing artifact org.springframework:spring-asm:jar:3.1.0.RELEASE:compile
    - Missing artifact javax.servlet:servlet-api:jar:2.5:provided
    - Missing artifact com.sun.jmx:jmxri:jar:1.2.1:compile
    - Missing artifact org.springframework:spring-webmvc:jar:3.1.0.RELEASE:compile
    - Missing artifact org.glassfish.web:jstl-impl:jar:1.2:compile
    - Missing artifact org.codehaus.jackson:jackson-core-asl:jar:1.8.1:compile
    - Missing artifact org.aspectj:aspectjrt:jar:1.6.10:compile
    - Missing artifact javax.annotation:jsr250-api:jar:1.0:compile
    - Missing artifact aopalliance:aopalliance:jar:1.0:compile
    - Missing artifact commons-pool:commons-pool:jar:1.5.4:compile
    - Missing artifact org.springframework:spring-context-support:jar:
     3.1.0.RELEASE:compile
    - Missing artifact commons-collections:commons-collections:jar:3.1:compile
    - Missing artifact commons-fileupload:commons-fileupload:jar:1.2.2:compile
    - Missing artifact mysql:mysql-connector-java:jar:5.1.15:compile
    - Missing artifact org.springframework:spring-aop:jar:3.1.0.RELEASE:compile
    - Missing artifact org.hibernate:ejb3-persistence:jar:1.0.2.GA:compile
    - Missing artifact antlr:antlr:jar:2.7.6:compile
    - Missing artifact org.springframework:spring-context:jar:3.1.0.RELEASE:compile
    - Missing artifact xml-apis:xml-apis:jar:1.0.b2:compile
    - Missing artifact dom4j:dom4j:jar:1.6.1:compile
    - Missing artifact javax.inject:javax.inject:jar:1:compile

I am just not able to understand that why am I getting this error?

Could someone help me understand?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

困倦 2025-01-01 15:16:51

关闭顶部的 标签是一个拼写错误?

也可能相关吗?

Closing </dependencies> tag on top is a typo?

Also may this be relevant?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文