I believe I have everything configured correctly such that grape ought to be asking the repository if there is a new revision, but it isn't. As long as the jar exists in .groovy/grapes it uses it.
I'm doing the grab via Java code via our application's API, so there can be some pre-processing not as easily handled if the script has @Grab, if that matters....
Map<String,Object> args = new HashMap<String, Object>();
args.put("validate", true);
args.put("classLoader", gcl);
Map<String,Object> dependencies = new HashMap<String, Object>();
dependencies.put("group", groupID);
dependencies.put("module", artifactID);
dependencies.put("version", version);
dependencies.put("force", true);
dependencies.put("changing", true);
Grape.grab(args, dependencies);
Where groupID, artifactID, and version are passed in from the caller's script.
If I delete the grapes cache it always correctly finds the latest revision. If I then upload a new revision of the same jar it doesn't even try to see if there is a new one (I've looked at the Artifactory log, which happens to be the repository I'm using, and it's also confirmed by the fact that the download count it lists is 0).
I've tried using no grapeConfig.xml (i.e. all defaults, and use Grape.addResolver to add repositories), and having a grapeConfig.xml that has my repositories, and also this line, which I gathered from another post is supposed to tell it how long to assume the cache is valid (unless I am misinterpreting that, but didn't work in any case).
<property name="ivy.cache.ttl.default" value="2m"/>
I've also observed that if I specify "*" for the version, grape DOES ask the repository for the metadata, but still doesn't seem to know that there is a newer revision. Furthermore, once I've done that, it can no longer find the specific version at all. I have to delete the cache to get it back to functioning with specific version.
Unfortunately I'm a newbie to posting here, so am not allowed to include an image of the dependencies I'm talking about as seen in Artifactory, but it would be something like this:
test
|----sample
|--------1.0-SNAPSHOT
|----------sample-1.0-20141125.185508-1.jar
|----------sample-1.0-20141125.185508-1.pom
grab("test","sample","1.0-SNAPSHOT") correctly returns the -1 version. If I then upload a new revision:
test
|----sample
|--------1.0-SNAPSHOT
|----------sample-1.0-20141125.185508-1.jar
|----------sample-1.0-20141125.185508-1.pom
|----------sample-1.0-20141125.191916-2.jar
|----------sample-1.0-20141125.191916-2.pom
grab("test","sample","1.0-SNAPSHOT") doesn't even ask the repository if there is something new, and returns the cached -1 jar.
grab("test","sample","*") asks the repository for metadata, but still returns the cached jar, and then renders grab("test","sample","1.0-SNAPSHOT") inoperative (returns NOT FOUND).
I feel like I must be missing something obvious here...
My knee jerk reaction is you are using it in a way that it was not intended and are therefore getting weird results. Instead, perhaps you should simply fetch the dependency more explicitly and leave Grape/Grab out of it.
Here is some sample code how you might do this...
Obviously this needs serious tweaking but should get latest dependency (it did for my project that needed this) and if it same as current, it should not appear as different.