You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-user@ant.apache.org by Jonathan Williams <sp...@gmail.com> on 2011/09/28 21:55:08 UTC

Ivy cache ignoring changingPattern on ibiblio resolver, not picking up latest SNAPSHOT artifact

Hi,

I'm trying to get Ivy to pick up the latest SNAPSHOT revision of an artifact
from my local Maven repository. I've looked through the documentation and
numerous examples online and followed the suggestions there, but I haven't
had any luck so far. Ivy finds and downloads the SNAPSHOT artifact the first
time without any issue and stores it in the cache. However, if that SNAPSHOT
artifact is subsequently updated in my Maven repo, Ivy will not pick up the
latest artifact. Here are the relevent parts of my ivysettings.xml

<property name="ivy.resolver.default.check.modified" value="true"/>

<resolvers>
    <chain name="default-chain" returnFirst="true">

            <filesystem name="enterprise" m2compatible="true">
                <ivy
pattern="${enterprise.repo.dir}/[organisation]/[module]/ivy.xml"/>
                <artifact
pattern="${enterprise.repo.dir}/[organisation]/[module]/[artifact].[ext]"/>
            </filesystem>
            <url name="shared" m2compatible="true" checksums="">
                <ivy
pattern="${shared.repo.dir}/[organisation]/[module]/[revision]/ivy.xml"/>
                <artifact
pattern="${shared.repo.dir}/[organisation]/[module]/[revision]/[artifact]-[revision](-[type]).[ext]"/>
            </url>

            <ibiblio name="maven-local" m2compatible="true"
root="${maven.cache.uri}" changingPattern=".*SNAPSHOT"/>
    </chain>
</resolvers>

Here are the contents of my local maven repo:

-rw-r--r-- 1 jwilliam xxxxxx 2042390 Sep 28 15:17
../../../../build/.cache/m2/com/foo/bar/0.0.1-SNAPSHOT/bar-0.0.1-SNAPSHOT.jar
-rw-r--r-- 1 jwilliam xxxxxx    7817 Sep 23 12:01
../../../../build/.cache/m2/com/foo/bar/0.0.1-SNAPSHOT/bar-0.0.1-SNAPSHOT.pom

And my ivy cache, notice how the bar-0.0.1-SNAPSHOT artifact is no longer up
to date (both size and timestamp different from the maven repo):

../../../../build/.cache/global/com.foo/bar:
total 2028
drwxr-xr-x  2 jwilliam xxxxxx    4096 Sep 28 14:56 .
drwxr-xr-x 20 jwilliam xxxxxx    4096 Sep 28 14:57 ..
-rw-r--r--  1 jwilliam xxxxxx    5925 Sep 23 12:01 ivy-0.0.1-SNAPSHOT.xml
-rw-r--r--  1 jwilliam xxxxxx    7817 Sep 23 12:01
ivy-0.0.1-SNAPSHOT.xml.original
-rw-r--r--  1 jwilliam xxxxxx     931 Sep 28 15:19
ivydata-0.0.1-SNAPSHOT.properties
-rw-r--r--  1 jwilliam xxxxxx 2042413 Sep 28 14:56
bar-0.0.1-SNAPSHOT-jar.jar

My dependency on com.foo:bar is declared as such:

        <dependency org="com.foo" name="bar" rev="0.0.1-SNAPSHOT"/>


Some of the things I've tried are tweaking the pattern I'm using in
changingPattern, explicitly setting the
'pattern="[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"'
and 'checkmodified="true"' fields. Nothing seems to work, short of deleting
my Ivy cache and forcing a re-download of the artifact.

Any ideas on what I'm doing that is different from all the examples I've
looked at that ostensibly work?

-Jonathan

Re: Ivy cache ignoring changingPattern on ibiblio resolver, not picking up latest SNAPSHOT artifact

Posted by Jonathan Williams <sp...@gmail.com>.
I went digging a bit this morning and came across this:

https://issues.apache.org/jira/browse/IVY-938

It seems like this problem has been around for a very long time!

I'll chalk it up as a known issue and continue to pursue the avenue of
getting maven to publish a pom with an updated timestamp.

-Jonathan

On Wed, Sep 28, 2011 at 5:26 PM, Jonathan Williams <spamhammer1234@gmail.com
> wrote:

> Hi Maarten,
>
> Thanks for the swift reply.
>
> Of all your suggestions, updating the pom.xml is what made it work. It
> looks like this issue centers around our maven build not publishing an
> effective pom.xml - instead it is publishing the pom.xml file stored in SCM
> with a correspondingly old timestamp. However, this is the default behaviour
> for Maven since 2.1. It seems like Ivy should ignore the timestamp on the
> pom.xml when dealing with a changing pattern on an ibiblio resolver, by
> default. There appears to be a workaround by telling our maven build to
> publish an effective pom.xml for each SNAPSHOT.
>
> -Jonathan
>
>
> On Wed, Sep 28, 2011 at 4:16 PM, Maarten Coene <ma...@yahoo.com>wrote:
>
>> I'm not 100% sure and I don't have the time to check now (sorry) but I
>> think Ivy will only check if an artifact has changed if the ivy file (or pom
>> file in your situation) has changed.
>> From the timestamps in your listing it seems that only the jar has been
>> updated and that the pom has remained unchanged.
>>
>> Could you try updating the pom as well to see if this solves your problem?
>>
>> In addition if I remember correctly, there is a bug in the chain resolver
>> in combination with changingPatterns: if you specify a changingPattern on a
>> child resolver, you must also specify it on the chain, otherwise Ivy won't
>> consider the resolver as changing.
>>
>> So, a second option to try could be adding the changingPattern attribute
>> to your chain resolver.
>>
>> A third possibility is to add changing="true" to your dependency,
>> something like:
>>
>> <dependency org="com.foo" name="bar" rev="0.0.1-SNAPSHOT"
>> changing="true"/>
>>
>> Maarten
>>
>>
>>
>> ________________________________
>> From: Jonathan Williams <sp...@gmail.com>
>> To: ivy-user@ant.apache.org
>> Sent: Wednesday, September 28, 2011 9:55 PM
>> Subject: Ivy cache ignoring changingPattern on ibiblio resolver, not
>> picking up latest SNAPSHOT artifact
>>
>> Hi,
>>
>> I'm trying to get Ivy to pick up the latest SNAPSHOT revision of an
>> artifact
>> from my local Maven repository. I've looked through the documentation and
>> numerous examples online and followed the suggestions there, but I haven't
>> had any luck so far. Ivy finds and downloads the SNAPSHOT artifact the
>> first
>> time without any issue and stores it in the cache. However, if that
>> SNAPSHOT
>> artifact is subsequently updated in my Maven repo, Ivy will not pick up
>> the
>> latest artifact. Here are the relevent parts of my ivysettings.xml
>>
>> <property name="ivy.resolver.default.check.modified" value="true"/>
>>
>> <resolvers>
>>     <chain name="default-chain" returnFirst="true">
>>
>>             <filesystem name="enterprise" m2compatible="true">
>>                 <ivy
>> pattern="${enterprise.repo.dir}/[organisation]/[module]/ivy.xml"/>
>>                 <artifact
>>
>> pattern="${enterprise.repo.dir}/[organisation]/[module]/[artifact].[ext]"/>
>>             </filesystem>
>>             <url name="shared" m2compatible="true" checksums="">
>>                 <ivy
>> pattern="${shared.repo.dir}/[organisation]/[module]/[revision]/ivy.xml"/>
>>                 <artifact
>>
>> pattern="${shared.repo.dir}/[organisation]/[module]/[revision]/[artifact]-[revision](-[type]).[ext]"/>
>>             </url>
>>
>>             <ibiblio name="maven-local" m2compatible="true"
>> root="${maven.cache.uri}" changingPattern=".*SNAPSHOT"/>
>>     </chain>
>> </resolvers>
>>
>> Here are the contents of my local maven repo:
>>
>> -rw-r--r-- 1 jwilliam xxxxxx 2042390 Sep 28 15:17
>>
>> ../../../../build/.cache/m2/com/foo/bar/0.0.1-SNAPSHOT/bar-0.0.1-SNAPSHOT.jar
>> -rw-r--r-- 1 jwilliam xxxxxx    7817 Sep 23 12:01
>>
>> ../../../../build/.cache/m2/com/foo/bar/0.0.1-SNAPSHOT/bar-0.0.1-SNAPSHOT.pom
>>
>> And my ivy cache, notice how the bar-0.0.1-SNAPSHOT artifact is no longer
>> up
>> to date (both size and timestamp different from the maven repo):
>>
>> ../../../../build/.cache/global/com.foo/bar:
>> total 2028
>> drwxr-xr-x  2 jwilliam xxxxxx    4096 Sep 28 14:56 .
>> drwxr-xr-x 20 jwilliam xxxxxx    4096 Sep 28 14:57 ..
>> -rw-r--r--  1 jwilliam xxxxxx    5925 Sep 23 12:01 ivy-0.0.1-SNAPSHOT.xml
>> -rw-r--r--  1 jwilliam xxxxxx    7817 Sep 23 12:01
>> ivy-0.0.1-SNAPSHOT.xml.original
>> -rw-r--r--  1 jwilliam xxxxxx     931 Sep 28 15:19
>> ivydata-0.0.1-SNAPSHOT.properties
>> -rw-r--r--  1 jwilliam xxxxxx 2042413 Sep 28 14:56
>> bar-0.0.1-SNAPSHOT-jar.jar
>>
>> My dependency on com.foo:bar is declared as such:
>>
>>         <dependency org="com.foo" name="bar" rev="0.0.1-SNAPSHOT"/>
>>
>>
>> Some of the things I've tried are tweaking the pattern I'm using in
>> changingPattern, explicitly setting the
>>
>> 'pattern="[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"'
>> and 'checkmodified="true"' fields. Nothing seems to work, short of
>> deleting
>> my Ivy cache and forcing a re-download of the artifact.
>>
>> Any ideas on what I'm doing that is different from all the examples I've
>> looked at that ostensibly work?
>>
>> -Jonathan
>>
>
>

Re: Ivy cache ignoring changingPattern on ibiblio resolver, not picking up latest SNAPSHOT artifact

Posted by Jonathan Williams <sp...@gmail.com>.
Hi Maarten,

Thanks for the swift reply.

Of all your suggestions, updating the pom.xml is what made it work. It looks
like this issue centers around our maven build not publishing an effective
pom.xml - instead it is publishing the pom.xml file stored in SCM with a
correspondingly old timestamp. However, this is the default behaviour for
Maven since 2.1. It seems like Ivy should ignore the timestamp on the
pom.xml when dealing with a changing pattern on an ibiblio resolver, by
default. There appears to be a workaround by telling our maven build to
publish an effective pom.xml for each SNAPSHOT.

-Jonathan

On Wed, Sep 28, 2011 at 4:16 PM, Maarten Coene <ma...@yahoo.com>wrote:

> I'm not 100% sure and I don't have the time to check now (sorry) but I
> think Ivy will only check if an artifact has changed if the ivy file (or pom
> file in your situation) has changed.
> From the timestamps in your listing it seems that only the jar has been
> updated and that the pom has remained unchanged.
>
> Could you try updating the pom as well to see if this solves your problem?
>
> In addition if I remember correctly, there is a bug in the chain resolver
> in combination with changingPatterns: if you specify a changingPattern on a
> child resolver, you must also specify it on the chain, otherwise Ivy won't
> consider the resolver as changing.
>
> So, a second option to try could be adding the changingPattern attribute to
> your chain resolver.
>
> A third possibility is to add changing="true" to your dependency, something
> like:
>
> <dependency org="com.foo" name="bar" rev="0.0.1-SNAPSHOT" changing="true"/>
>
> Maarten
>
>
>
> ________________________________
> From: Jonathan Williams <sp...@gmail.com>
> To: ivy-user@ant.apache.org
> Sent: Wednesday, September 28, 2011 9:55 PM
> Subject: Ivy cache ignoring changingPattern on ibiblio resolver, not
> picking up latest SNAPSHOT artifact
>
> Hi,
>
> I'm trying to get Ivy to pick up the latest SNAPSHOT revision of an
> artifact
> from my local Maven repository. I've looked through the documentation and
> numerous examples online and followed the suggestions there, but I haven't
> had any luck so far. Ivy finds and downloads the SNAPSHOT artifact the
> first
> time without any issue and stores it in the cache. However, if that
> SNAPSHOT
> artifact is subsequently updated in my Maven repo, Ivy will not pick up the
> latest artifact. Here are the relevent parts of my ivysettings.xml
>
> <property name="ivy.resolver.default.check.modified" value="true"/>
>
> <resolvers>
>     <chain name="default-chain" returnFirst="true">
>
>             <filesystem name="enterprise" m2compatible="true">
>                 <ivy
> pattern="${enterprise.repo.dir}/[organisation]/[module]/ivy.xml"/>
>                 <artifact
> pattern="${enterprise.repo.dir}/[organisation]/[module]/[artifact].[ext]"/>
>             </filesystem>
>             <url name="shared" m2compatible="true" checksums="">
>                 <ivy
> pattern="${shared.repo.dir}/[organisation]/[module]/[revision]/ivy.xml"/>
>                 <artifact
>
> pattern="${shared.repo.dir}/[organisation]/[module]/[revision]/[artifact]-[revision](-[type]).[ext]"/>
>             </url>
>
>             <ibiblio name="maven-local" m2compatible="true"
> root="${maven.cache.uri}" changingPattern=".*SNAPSHOT"/>
>     </chain>
> </resolvers>
>
> Here are the contents of my local maven repo:
>
> -rw-r--r-- 1 jwilliam xxxxxx 2042390 Sep 28 15:17
>
> ../../../../build/.cache/m2/com/foo/bar/0.0.1-SNAPSHOT/bar-0.0.1-SNAPSHOT.jar
> -rw-r--r-- 1 jwilliam xxxxxx    7817 Sep 23 12:01
>
> ../../../../build/.cache/m2/com/foo/bar/0.0.1-SNAPSHOT/bar-0.0.1-SNAPSHOT.pom
>
> And my ivy cache, notice how the bar-0.0.1-SNAPSHOT artifact is no longer
> up
> to date (both size and timestamp different from the maven repo):
>
> ../../../../build/.cache/global/com.foo/bar:
> total 2028
> drwxr-xr-x  2 jwilliam xxxxxx    4096 Sep 28 14:56 .
> drwxr-xr-x 20 jwilliam xxxxxx    4096 Sep 28 14:57 ..
> -rw-r--r--  1 jwilliam xxxxxx    5925 Sep 23 12:01 ivy-0.0.1-SNAPSHOT.xml
> -rw-r--r--  1 jwilliam xxxxxx    7817 Sep 23 12:01
> ivy-0.0.1-SNAPSHOT.xml.original
> -rw-r--r--  1 jwilliam xxxxxx     931 Sep 28 15:19
> ivydata-0.0.1-SNAPSHOT.properties
> -rw-r--r--  1 jwilliam xxxxxx 2042413 Sep 28 14:56
> bar-0.0.1-SNAPSHOT-jar.jar
>
> My dependency on com.foo:bar is declared as such:
>
>         <dependency org="com.foo" name="bar" rev="0.0.1-SNAPSHOT"/>
>
>
> Some of the things I've tried are tweaking the pattern I'm using in
> changingPattern, explicitly setting the
>
> 'pattern="[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"'
> and 'checkmodified="true"' fields. Nothing seems to work, short of deleting
> my Ivy cache and forcing a re-download of the artifact.
>
> Any ideas on what I'm doing that is different from all the examples I've
> looked at that ostensibly work?
>
> -Jonathan
>

Re: Ivy cache ignoring changingPattern on ibiblio resolver, not picking up latest SNAPSHOT artifact

Posted by Maarten Coene <ma...@yahoo.com>.
I'm not 100% sure and I don't have the time to check now (sorry) but I think Ivy will only check if an artifact has changed if the ivy file (or pom file in your situation) has changed.
From the timestamps in your listing it seems that only the jar has been updated and that the pom has remained unchanged.

Could you try updating the pom as well to see if this solves your problem?

In addition if I remember correctly, there is a bug in the chain resolver in combination with changingPatterns: if you specify a changingPattern on a child resolver, you must also specify it on the chain, otherwise Ivy won't consider the resolver as changing.

So, a second option to try could be adding the changingPattern attribute to your chain resolver.

A third possibility is to add changing="true" to your dependency, something like:

<dependency org="com.foo" name="bar" rev="0.0.1-SNAPSHOT" changing="true"/>

Maarten



________________________________
From: Jonathan Williams <sp...@gmail.com>
To: ivy-user@ant.apache.org
Sent: Wednesday, September 28, 2011 9:55 PM
Subject: Ivy cache ignoring changingPattern on ibiblio resolver, not picking up latest SNAPSHOT artifact

Hi,

I'm trying to get Ivy to pick up the latest SNAPSHOT revision of an artifact
from my local Maven repository. I've looked through the documentation and
numerous examples online and followed the suggestions there, but I haven't
had any luck so far. Ivy finds and downloads the SNAPSHOT artifact the first
time without any issue and stores it in the cache. However, if that SNAPSHOT
artifact is subsequently updated in my Maven repo, Ivy will not pick up the
latest artifact. Here are the relevent parts of my ivysettings.xml

<property name="ivy.resolver.default.check.modified" value="true"/>

<resolvers>
    <chain name="default-chain" returnFirst="true">

            <filesystem name="enterprise" m2compatible="true">
                <ivy
pattern="${enterprise.repo.dir}/[organisation]/[module]/ivy.xml"/>
                <artifact
pattern="${enterprise.repo.dir}/[organisation]/[module]/[artifact].[ext]"/>
            </filesystem>
            <url name="shared" m2compatible="true" checksums="">
                <ivy
pattern="${shared.repo.dir}/[organisation]/[module]/[revision]/ivy.xml"/>
                <artifact
pattern="${shared.repo.dir}/[organisation]/[module]/[revision]/[artifact]-[revision](-[type]).[ext]"/>
            </url>

            <ibiblio name="maven-local" m2compatible="true"
root="${maven.cache.uri}" changingPattern=".*SNAPSHOT"/>
    </chain>
</resolvers>

Here are the contents of my local maven repo:

-rw-r--r-- 1 jwilliam xxxxxx 2042390 Sep 28 15:17
../../../../build/.cache/m2/com/foo/bar/0.0.1-SNAPSHOT/bar-0.0.1-SNAPSHOT.jar
-rw-r--r-- 1 jwilliam xxxxxx    7817 Sep 23 12:01
../../../../build/.cache/m2/com/foo/bar/0.0.1-SNAPSHOT/bar-0.0.1-SNAPSHOT.pom

And my ivy cache, notice how the bar-0.0.1-SNAPSHOT artifact is no longer up
to date (both size and timestamp different from the maven repo):

../../../../build/.cache/global/com.foo/bar:
total 2028
drwxr-xr-x  2 jwilliam xxxxxx    4096 Sep 28 14:56 .
drwxr-xr-x 20 jwilliam xxxxxx    4096 Sep 28 14:57 ..
-rw-r--r--  1 jwilliam xxxxxx    5925 Sep 23 12:01 ivy-0.0.1-SNAPSHOT.xml
-rw-r--r--  1 jwilliam xxxxxx    7817 Sep 23 12:01
ivy-0.0.1-SNAPSHOT.xml.original
-rw-r--r--  1 jwilliam xxxxxx     931 Sep 28 15:19
ivydata-0.0.1-SNAPSHOT.properties
-rw-r--r--  1 jwilliam xxxxxx 2042413 Sep 28 14:56
bar-0.0.1-SNAPSHOT-jar.jar

My dependency on com.foo:bar is declared as such:

        <dependency org="com.foo" name="bar" rev="0.0.1-SNAPSHOT"/>


Some of the things I've tried are tweaking the pattern I'm using in
changingPattern, explicitly setting the
'pattern="[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"'
and 'checkmodified="true"' fields. Nothing seems to work, short of deleting
my Ivy cache and forcing a re-download of the artifact.

Any ideas on what I'm doing that is different from all the examples I've
looked at that ostensibly work?

-Jonathan