【问题标题】:Ivy Unresolved Dependency When Using Spring Data JPA - org.eclipse.persistence使用 Spring Data JPA 时常春藤未解决的依赖关系 - org.eclipse.persistence
【发布时间】:2013-02-14 20:33:52
【问题描述】:

在我将以下行添加到我的 ivy.xml 文件之前,我的构建运行良好:

<dependency org="org.springframework.data" name="spring-data-jpa" rev="1.1.0.RELEASE"/>

然后我得到以下错误:

::::::::::::::::::::::::::::::::::::::::::::::
::          UNRESOLVED DEPENDENCIES         ::
::::::::::::::::::::::::::::::::::::::::::::::
:: org.eclipse.persistence#org.eclipse.persistence.jpa;2.3.2: not found
:::::::::::::::::::::::::::::::::::::::::::::: 

我似乎在 Maven 存储库中找不到这种依赖关系。不使用 Ivy 时,我可以用这个 jar 成功编译我的项目:

com.springsource.javax.persistence-2.0.0.jar

但是,我在 Maven 存储库中也找不到对那个的引用。

我错过了什么或做错了什么?刚开始使用 Ivy,因此感谢您提供任何和所有帮助。

【问题讨论】:

    标签: spring maven ant ivy spring-data-jpa


    【解决方案1】:

    默认情况下,ivy 会拉下所有依赖项。这很可能是Maven Central 中不存在的可选 Maven 依赖项。

    您需要为每个依赖项设置一个 ivy 配置映射,如下所示:

    <configurations>
        <conf name="compile" description="Compile classpath"/>
        <conf name="runtime" description="Runtime classpath" extends="compile"/>
        <conf name="test" description="Test classpath" extends="runtime"/>
    </configurations>
    
    <dependencies>
        <!-- compile dependencies -->
        <dependency org="org.springframework.data" name="spring-data-jpa" rev="1.1.0.RELEASE" conf="compile->default"/>
    </dependencies>
    

    映射“compile->default”意味着从远程模块中拉下默认依赖项(这将排除可选)并将它们放入本地编译配置中。

    有关 ivy 如何翻译远程 Maven 模块的更多信息,请参阅:

    【讨论】:

    • 这很有帮助。谢谢!
    猜你喜欢
    • 2016-10-08
    • 1970-01-01
    • 2012-08-05
    • 2010-12-07
    • 1970-01-01
    • 2012-09-05
    • 2011-09-15
    • 1970-01-01
    • 2012-08-20
    相关资源
    最近更新 更多