David Moles
David Moles

Reputation: 51113

Making Gradle notice new repositories, or: Gradle equivalent of Maven's -U / --update-snapshots

I have a Gradle project with some dependencies that turned out not to be in Maven central. I tracked them down in the Typesafe repo and added

maven {
    url 'http://repo.typesafe.com/typesafe/repo'
}

to my build.gradle file, but Gradle continued to report the dependencies missing.

I guessed fairly quickly that what I was looking at was the equivalent of Maven's failure to find X in Y was cached in the local repository, resolution will not be reattempted but there wasn't any obvious way (cf mvn -U) to tell Gradle to un-cache that failure.

Eventually I tried adding {changing = true} to that family of dependencies, which apparently told Gradle to try those again, and it found them just fine. I suppose I could also have blown away my whole artifact cache. But it seems like there should be a faster way to fix this. Is there an easy way to either:

  1. force Gradle to re-check for missing dependencies, or
  2. force Gradle to notice that new repositories have been added, and that it might want to try looking in those instead?

Upvotes: 2

Views: 353

Answers (1)

Peter Niederwieser
Peter Niederwieser

Reputation: 123910

The equivalent to mvn -U is gradle --refresh-dependencies. Type gradle -h to see all command line options.

Upvotes: 2

Related Questions