Snapshots are Not Updated


(my accounts) #1

1.0-milestone-9-20120302221845+0100

snapshots are not updated:

project A:
 0.0.1.BUILD-SNAPSHOT
        project B:
 depends on "0.0.1-BUILD-SNAPSHOT"

Whenever the “project A” is updated and uploaded to the repo ( via uploadArchives { repositories.mavenDeployer … } ), “project B” does not pick up a “fresh” 0.0.1.BUILD-SNAPSHOT version of the “project A”, but rather uses the one in a cache.

http://issues.gradle.org/browse/GRADLE-629 says to be fixed, but the issue is still there.


#2

This is certainly working in Milestone-8, and I’d be surprised if it regressed in the build you are using.

By default, SNAPSHOT dependencies are cached and updated once every 24 hours. If you require a SNAPSHOT dependency to be updated on every build, you can do:

configurations.all {
    resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}

Check out the user guide for more info.


(my accounts) #3

Daz,

Is it suppose to update ALL dependencies on every build (if set to 0), or just SNAPSHOTs?

Thank you.


#4

When using a maven repository, modules with a version ending in “SNAPSHOT” are considered to be ‘changing modules’. Other modules are not.

It’s worth reading the Dependency Management chapter of the user guide to get a better understanding of how these things work.


(my accounts) #5

Daz,

I can see Gradle pulling in SNAPSHOTs properly from command line now.

However, when I try to update IDEA with “gradle clean ideaModule”, the SNAPSHOT is not updated in the cache.

I have:

idea.project.ipr.beforeMerged {
    module ->
        module.dependencies.clear()
}

But it does not help.

Thank you.


(my accounts) #6

Taking it back. I figured out what is going on.

SNAPSHOTs are properly updated. It’s

BUILD-SNAPSHOT-sources

that are NOT. Hence in IDEA, unless I run tests, I see no changes to the file. Any way Gradle can update “BUILD-SNAPSHOT” and “BUILD-SNAPSHOT-sources”?

Thank you.


#7

There’s not really a way to do this at this time. As a one-off, try running Gradle with ‘–refresh=dependencies’. This will update all of the cached dependencies.

Gradle is smart about this, and will only download the dependencies if they have changed, based on published *.sha1 files.


(my accounts) #8

I see. That seems to work, although is taking some time to checksum all the SHA1…

gradle -ai --refresh=dependencies ideaModule

Thank you Daz.


(cwocwo1) #9

–refresh dependencies is so slow. Is there any good way?

http://issues.gradle.org/browse/GRADLE-2218


#10

There is another way, using an experimental and subject-to-change cache control DSL: check out Sean’s ultimate response to http://forums.gradle.org/gradle/topics/gradle_1_0_milestone_8a_doesnt_seem_to_be_honoring_changingpattern_in_ivy_resolvers.