【问题标题】:Could not resolve dependencies for hibernate无法解决休眠的依赖关系
【发布时间】:2013-09-11 07:18:47
【问题描述】:

我有一个使用 primefaces 3.5、mysql 的简单 webapp,我想添加 hibernate 作为 orm 提供程序。我使用 NetBeans 7.3。当我尝试构建我的项目时,出现以下错误:

Failed to execute goal on project ogloszenia: Could not resolve dependencies for project   com.mycompany:ogloszenia:war:1.0-SNAPSHOT: The following artifacts could not be resolved:  org.hibernate:hibernate:jar:3.5.4-Final, javax.sql:jdbc-stdext:jar:2.0, javax.transaction:jta:jar:1.0.1B: Failure to find org.hibernate:hibernate:jar:3.5.4-Final in http://repository.primefaces.org was cached in the local repository, resolution will not be reattempted until the update interval of prime-repo has elapsed or updates are forced -> [Help 1]

这是我的 pom 片段:

<properties>
    <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <glassfish.embedded-static-shell.jar>/home/arek/glassfish-  3.1.2.2/glassfish/lib/embedded/glassfish-embedded-static-shell.jar</glassfish.embedded-  static-shell.jar>
</properties>
<dependencies>
<dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>3.5</version>
    </dependency>
    <dependency>  
    <groupId>org.primefaces.themes</groupId>  
  <artifactId>excite-bike</artifactId>  
  <version>1.0.9</version>  
  </dependency>
    <dependency>
        <groupId>taglibs</groupId>
        <artifactId>standard</artifactId>
        <version>1.1.2</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate</artifactId>
        <version>3.5.4-Final</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>3.5.4-Final</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>javax.sql</groupId>
        <artifactId>jdbc-stdext</artifactId>
        <version>2.0</version>
    </dependency>
    <dependency>
        <groupId>javax.transaction</groupId>
        <artifactId>jta</artifactId>
        <version>1.0.1B</version>
    </dependency>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-web-api</artifactId>
        <version>6.0</version>
        <scope>provided</scope>
    </dependency>
    <!-- JSF 2 -->
    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-api</artifactId>
        <version>2.1.24</version>
                    <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-impl</artifactId>
        <version>2.1.24</version>
                    <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.1.2</version>
                    <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
                    <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.1</version>
                    <scope>provided</scope>
    </dependency>
            <dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1</version>
    <scope>provided</scope>
</dependency>
  <dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.26</version>
 </dependency>
     <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
 </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
                <compilerArguments>
                    <endorseddirs>${endorsed.dir}</endorseddirs>
                </compilerArguments>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.1</version>
            <executions>
                <execution>
                    <phase>validate</phase>
                    <goals>
                        <goal>copy</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${endorsed.dir}</outputDirectory>
                        <silent>true</silent>
                        <artifactItems>
                            <artifactItem>
                                <groupId>javax</groupId>
                                <artifactId>javaee-endorsed-api</artifactId>
                                <version>6.0</version>
                                <type>jar</type>
                            </artifactItem>
                        </artifactItems>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>

我搜索并尝试了一些解决方案但没有帮助(我删除了存储库并再次下载等)有人有什么想法吗?感谢您的帮助

【问题讨论】:

    标签: hibernate maven maven-2 pom.xml


    【解决方案1】:

    hibernate 工件已被拆分为更小的部分,包括 hibernate-core,这应该是您正在寻找的。​​p>

    http://mvnrepository.com/artifact/org.hibernate/hibernate-core

    【讨论】:

    • 谢谢,但没用。我想知道为什么应用程序会尝试从 repository.primefaces.org?(Could 下载休眠,但在 prime-repo (repository.primefaces.org) 中找不到工件 org.hibernate:hibernate:jar:4.0.0.Final。
    • 因为您必须查找 org.hibernate:hibernate-core:jar 也许您应该使用 mvn dependency:tree -Dverbose 检查您的依赖关系,并查看哪个工件正在尝试下载 org.hibernate:hibernate:罐子
    • “查找 org.hibernate:hibernate-core:jar”是什么意思?
    • 你的依赖应该是:org.hibernatehibernate-core3.5.4-Final编译
    猜你喜欢
    • 2016-02-16
    • 2017-02-20
    • 2018-05-25
    • 2020-07-01
    • 2019-09-14
    相关资源
    最近更新 更多