1

Having a problem with Ivy + Maven Snapshots + rev="latest.revision". Ivy is properly parsing the metadata to discover the latest version of the artifact, but it seems to decline downloading it. I'm stuck with an earlier version of the artifact. Does the text below give anyone any ideas why it's doing it?

[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

I looked at this and tried setting the pattern the same, but it didn't seem to help. I'm hoping to avoid workarounds like this.

Community
  • 1
  • 1
Nick Spacek
  • 4,717
  • 4
  • 39
  • 42
  • I don't use ivy, but is this the maven only checking for newer snapshots once a day behavior? That's what maven does, you know. Using Maven directly, you avoid this via the -U flag. – chad Dec 11 '12 at 17:15
  • Good point, however Ivy doesn't use Maven directly. Rather, it supports parsing Maven metadata and the Maven directory structure. I believe I've specified all the relevant Ivy configuration options, as seen by the output above. It parses the Maven metadata and determines the latest version of the artifact, but it doesn't resolve it fully (as in, actually downloading it to Ivy cache). – Nick Spacek Dec 11 '12 at 20:30

1 Answers1

1

Downloading snapshots works for me. I've supplied a working example below. Possible to supply more details?

I've seen issues with Maven snapshots in the past but that was because the repository metadata files were not being updated as expected, resulting in the wrong artifact being downloaded.

Another possible issue is a invalid cache. Perhaps you could try and purge it (See the "clean-all" target in the example below).

Example

[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>
Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185
  • @NickSpacek You're confusing me now. Are you trying to get ivy to detect SNAPSHOTS in the Maven local repo? Unlikely that will work (The ibiblio resolver is the one aware of Maven meta data, not the filesystem resolver). Additionally, I just re-checked. My example ivy.xml file specifies "2.7-SNAPSHOT" not "latest.integration". This might explain the difference. – Mark O'Connor Dec 13 '12 at 20:34
  • That's my fault, sorry. I was talking about a remote repository, but I'm having a similar issue with local installs and got myself confused. – Nick Spacek Dec 14 '12 at 11:46
  • 1
    @NickSpacek So have you tried to specify just the snapshot revision? For example "2.7-SNAPSHOT"?? That should work fine. It's the "latest.integration" feature that doesn't appear to be Maven friendly :-) – Mark O'Connor Dec 16 '12 at 18:38
  • @NickSpacek Snapshot revisions are peculiar to Maven. They don't work the same way as integration revisions in other systems. In Maven you ask for a specific revision (In your case 0.0.3-SNAPSHOT) and you get the latest copy at that revision. The "latest.integration" feature in ivy is designed to parse the available revisions and decided which is the latest. The two approaches are confusingly different. The best advice is to stick to the Maven method :-) – Mark O'Connor Dec 16 '12 at 21:09
  • @MarkOConnor I see... kind of. So, is the issue that the ibiblio resolver is deciding incorrectly, or is it functioning as intended? Maybe I should enter a bug report and see what the consensus is. If it's behaving as intended that's ok, but I'm still not clear on why latest.integration wouldn't retrieve the most recent version and most recent SNAPSHOT build. Thanks for your suggestions though! Even if it's not ideal, it will work better than the current approach which has us deleting old versions from repositories to make it work. – Nick Spacek Dec 17 '12 at 11:57
  • Thank! The did the trick for me, however it will clean ALL the cache which takes a long time in the next resolve. Can't find a way to only clean the cache of a single dep which would be perfect for me. – JavierJ Sep 26 '15 at 01:26