在常春藤中没有解决Spring Framework依赖关系

时间:2011-10-18 20:12:26

标签: ivy dependency-management

我正在尝试使用Ivy下载Spring Batch和Spring Framework,而且我没有走得太远。

ivy.xml中的依赖项:

<dependency org="org.springframework.batch" name="org.springframework.batch.core" rev="2.1.6.RELEASE" />
<dependency org="org.springframework" name="org.springframework.spring-library" rev="3.0.6.RELEASE" />

ivysettings.xml:

<ivysettings>
<settings defaultResolver="chained"/>
<resolvers>
    <chain name="chained">
        <url name="com.springsource.repository.bundles.release">
            <ivy pattern="http://repository.springsource.com/ivy/bundles/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
            <artifact pattern="http://repository.springsource.com/ivy/bundles/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
        </url>
        <url name="com.springsource.repository.bundles.external">
            <ivy pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
            <artifact pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
        </url>
    </chain>
</resolvers>
</ivysettings>

的build.xml:

...
<ivy:settings file="ivysettings.xml"/>
...
<target name="resolve" description="retrieve dependencies with ivy">
    <ivy:retrieve/>
</target>    

当我运行ant resolve时,我得到以下内容:

[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]      ::          UNRESOLVED DEPENDENCIES         ::
[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]      :: org.springframework#org.springframework.spring-library;3.0.6.RELEASE: not found
[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::

我做错了什么? I've used this page用于获取配置。

1 个答案:

答案 0 :(得分:1)

Spring库现在通过Maven Central发布。这意味着可以使用Maven搜索网站找到它们:

这意味着您需要按如下方式声明依赖项:

<dependency org="org.springframework.batch" name="spring-batch-core" rev="2.1.8.RELEASE"/>
<dependency org="org.springframework" name="spring-core" rev="3.0.6.RELEASE"/>

设置文件现在变为可选(Maven Central是常春藤默认设置)。

如果要创建一个,请使用以下内容:

<ivysettings>
    <settings defaultResolver="central"/>
    <resolvers>
        <ibiblio name="central" m2compatible="true"/>
    </resolvers>
</ivysettings>