常春藤使用Maven快照“修订已经解决”

时间:2012-12-11 13:53:35

标签: java maven ivy

遇到Ivy + Maven Snapshots + rev =“latest.revision”的问题。 Ivy正在解析元数据以发现工件的最新版本,但它似乎拒绝下载它。我坚持使用早期版本的工件。下面的文字是否会让任何人知道它为什么这样做?

[ivy:resolve]   listing revisions from maven-metadata: http://my-maven/content/repositories/snapshots/ca/spacek/api-project/maven-metadata.xml
[ivy:resolve]   my-snapshots: found md file for ca.spacek#api-project;latest.integration
[ivy:resolve]           => http://my-maven/content/repositories/snapshots/ca/spacek/api-project/0.0.3-SNAPSHOT/api-project-0.0.3-20121211.132856-8.pom (0.0.3-SNAPSHOT)
[ivy:resolve]   my-snapshots: revision already resolved: ca.spacek#api-project;0.0.3-SNAPSHOT

我查看this并尝试将pattern设置为相同,但似乎没有帮助。我希望避免像this这样的解决方法。

1 个答案:

答案 0 :(得分:1)

下载快照对我有用。我在下面提供了一个工作示例。可以提供更多细节吗?

我在过去看过Maven快照的问题,但那是因为存储库元数据文件未按预期更新,导致下载错误的工件。

另一个可能的问题是缓存无效。也许您可以尝试清除它(请参阅下面示例中的“全部清除”目标)。

实施例

[ivy:resolve] :: Apache Ivy 2.3.0-rc1 - 20120416000235 :: http://ant.apache.org/ivy/ ::
[ivy:resolve] :: loading settings :: file = /?????/ivysettings.xml
[ivy:resolve] :: resolving dependencies :: myOrg#Demo;????
[ivy:resolve]   confs: [default]
[ivy:resolve]   found commons-lang#commons-lang;2.7-SNAPSHOT in apache-snapshots
[ivy:resolve] downloading https://repository.apache.org/content/groups/snapshots/commons-lang/commons-lang/2.7-SNAPSHOT/commons-lang-2.7-20120610.132226-5.jar ...

的build.xml

<project name="demo" default="resolve" xmlns:ivy="antlib:org.apache.ivy.ant">

    <property name="build.dir" location="build"/>

    <target name="resolve" description="Use ivy to resolve classpaths">
        <ivy:resolve/>
    </target>

    <target name="clean" description="Cleanup build files">
        <delete dir="${build.dir}"/>
    </target>

    <target name="clean-all" depends="clean" description="Additionally purge ivy cache">
        <ivy:cleancache/>
    </target>

</project>

的ivy.xml

<ivy-module version="2.0">
    <info organisation="myOrg" module="Demo"/>
    <dependencies>
        <dependency org="commons-lang" name="commons-lang" rev="2.7-SNAPSHOT"/>
    </dependencies>
</ivy-module>

ivysettings.xml

<ivysettings>
    <settings defaultResolver="repos" />
    <resolvers>
        <chain name="repos">
            <ibiblio name="central" m2compatible="true"/>   
            <ibiblio name="apache-snapshots" m2compatible="true" root="https://repository.apache.org/content/groups/snapshots"/>   
        </chain>
    </resolvers>
</ivysettings>