java - spring-data-jpa 1.6 需要 spring 框架 3 库,是真的吗,还是我错过了什么?

标签 java spring maven spring-data-jpa

来自不同的问题,我发现我的 Spring 库有点困惑。

我有 Spring-4.0.5 库(是的,我想要它们)和 Spring 3.2.9 库,它们显然是通过 maven 作为 spring-data-jpa-1.6 依赖项给出的。 Spring-data-jpa 1.4 似乎没有拉取 spring 3 库,但我绝对更愿意使用当前的 1.6。

Maven:

<properties>
    <org.springframework.version>4.0.5.RELEASE</org.springframework.version>
</properties>
<dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-jpa</artifactId>
    <version>1.6.0.RELEASE</version>
</dependency>
[...]

任何人都可以证实这一点,还是我只是做了一些完全错误的事情?

最佳答案

dexBerlins 答案的替代方法是使用 元素。这样做的优点是,当您使用它时,groupid 和artifactid 的任何传递依赖项都将被忽略,并使用您在元素中指定的版本。基本上是全局覆盖:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>4.0.5.RELEASE</version>
        </dependency>
    </dependencies>
</dependencyManagement>

文档 -> http://maven.apache.org/pom.html#Dependencies

关于java - spring-data-jpa 1.6 需要 spring 框架 3 库,是真的吗,还是我错过了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24493119/

相关文章:

递归中的 Java decToHex - 错误的输出顺序

java - spring security ldap隐藏密码属性

java - 使用 spring boot 的 LinkedIn 身份验证

maven - 如何将构建时间戳添加到使用 Tycho 构建的应用程序的标题中

java - 这个 JSON 有什么问题?

java - Jini/JavaSpaces 发现错误

java - Android Studio Google JAR 文件导致 GC 开销限制超出错误

java - Controller 在浏览器中打开文件而不是下载它

java - 发布一个简单的 Java 库到 Maven

node.js - 无法运行 Node : No such file or directory