[groovy-user] How to tell Grape to refresh updated snapshots?

490 views
Skip to first unread message

Matthew Adams

unread,
May 27, 2010, 1:21:10 PM5/27/10
to us...@groovy.codehaus.org
Hi all,

I'm using Grape in a script that automatically grabs dependencies.
Some dependencies are artifacts from my own Maven projects and are
snapshots. Problem is, if the local grape cache, ~/.groovy/grapes,
already contains an artifact with the named groupId, artifactId, and
version (whatever-SNAPSHOT), grape won't grab the newer version of the
snapshot and use it because it thinks that it's got the right version
based on the version identifier but not on the artifact file's date
stamp.

How do I tell Grape to check Maven repos for updated versions of
snapshots and force it to update the Grape cache with those?

-matthew

--
mailto:mat...@matthewadams.me
skype:matthewadams12
yahoo:matthewadams
aol:matthewadams12
google-talk:matthew...@gmail.com
msn:mat...@matthewadams.me
http://matthewadams.me
http://www.linkedin.com/in/matthewadams

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Jim White

unread,
May 27, 2010, 3:26:23 PM5/27/10
to us...@groovy.codehaus.org
Darn good question.

This is actually more of an Ivy issue, and the last time I had to deal
with that problem many moons ago there was no way to deal with that
automagically. It could be helpful if you would ask on the Ivy list
what the best way to do automatic snapshots updates is and let us know
what they say.

One thing I've done for dev purposes is have a script that nukes the
snapshots that I run when necessary. Of course when the build machine
and the client machine are the same, I just have the build script
install the new snapshot in the cache.

Jim

Matthew Adams wrote:

> Hi all,
>
> I'm using Grape in a script that automatically grabs dependencies.
> Some dependencies are artifacts from my own Maven projects and are
> snapshots. Problem is, if the local grape cache, ~/.groovy/grapes,
> already contains an artifact with the named groupId, artifactId, and
> version (whatever-SNAPSHOT), grape won't grab the newer version of the
> snapshot and use it because it thinks that it's got the right version
> based on the version identifier but not on the artifact file's date
> stamp.
>
> How do I tell Grape to check Maven repos for updated versions of
> snapshots and force it to update the Grape cache with those?
>
> -matthew
>

Matthew Adams

unread,
May 27, 2010, 7:51:00 PM5/27/10
to us...@groovy.codehaus.org
Hi Jim,

> Darn good question.
>
Great -- that's just what I want to hear. :(

> This is actually more of an Ivy issue, and the last time I had to deal with
> that problem many moons ago there was no way to deal with that
> automagically.  It could be helpful if you would ask on the Ivy list what
> the best way to do automatic snapshots updates is and let us know what they
> say.
>

Will do.

> One thing I've done for dev purposes is have a script that nukes the
> snapshots that I run when necessary.  Of course when the build machine and
> the client machine are the same, I just have the build script install the
> new snapshot in the cache.
>

That's what I did, too. :(

saltnlight5

unread,
Jul 11, 2012, 7:11:16 AM7/11/12
to us...@groovy.codehaus.org
Hi Groovy folks,

Sorry to brin up an old post, but I encountered the same problem today
still, and yet have not found a solution. I use the following in my script:

@GrabResolver(name='snapshot',
root='http://oss.sonatype.org/content/groups/public')
@Grab('org.bitbucket.timemachine:timemachine-scheduler:1.2.0-SNAPSHOT')
def test(){}

The problem is that it never refresh to the latest snapshot. Is there way to
force @Grab to do this?

Thanks
Zemian

--
View this message in context: http://groovy.329449.n5.nabble.com/How-to-tell-Grape-to-refresh-updated-snapshots-tp355460p5710615.html
Sent from the groovy - user mailing list archive at Nabble.com.

Tim Yates

unread,
Jul 11, 2012, 7:38:30 AM7/11/12
to us...@groovy.codehaus.org
Not sure if it works, but does:

@GrabResolver(name='snapshot', root='http://oss.sonatype.org/content/groups/public')
@Grab( group='org.bitbucket.timemachine',
       module='timemachine-scheduler',
       version='1.2.0-SNAPSHOT',
       changing=true )

Help?  The docs seem to hint it should...

Tim

Paul King

unread,
Jul 11, 2012, 8:07:44 AM7/11/12
to us...@groovy.codehaus.org

It's all more complicated than it should be.
We rely on Ivy for this which uses grapeConfig.xml file.
Your mileage may vary depending on what repos you may have
added to that file.

I do know that if I comment out the "cachedGrapes" repo in my
config file (which leaves the downloaded grapes in my .m2 repo)
and then I ensure that the .m2 repo is there and has the following
attributes:

checkmodified="true" changingPattern=".*" changingMatcher="regexp"

... then snapshots work for me. Adding the above attributes to
a filesystem repo didn't use to work (haven't tried recently).

We have been meaning to find a better way than relying on Ivy.
Geb for instance at one point had a custom resolver which fixed
up part of this issue (still Ivy based) and gradle has also rolled
their own solution to this problem I believe.

Cheers, Paul.

Paul King

unread,
Jul 11, 2012, 8:10:45 AM7/11/12
to us...@groovy.codehaus.org

And I forgot to mention. Per Tim's suggestion, you can set
changing=true - we pass that through at the api level - but
depending on how you have your repos configured it may not
do anything.

Cheers, Paul.

saltnlight5

unread,
Jul 11, 2012, 4:37:04 PM7/11/12
to us...@groovy.codehaus.org
Hi Tim and Paul,

I just tried this and it's still not working yet.
@Grab( group='org.bitbucket.timemachine',
module='timemachine-scheduler',
version='1.2.0-SNAPSHOT',
changing=true )

I googled this further and this seemed to have caused few other projets the
same as well (just as you already mentioned.). Well, at this point, I will
just live with by deleting the cache directory. I do hope we have a better
and consistent solution in future. :)

Thanks
Zemian
PS: The @Grab/Grape annotations feature is really cool. Thanks for all the
good work!

--
View this message in context: http://groovy.329449.n5.nabble.com/How-to-tell-Grape-to-refresh-updated-snapshots-tp355460p5710628.html
Reply all
Reply to author
Forward
0 new messages