Home > Enterprise >  Gradle, mavenLocal() and --refresh-dependencies
Gradle, mavenLocal() and --refresh-dependencies

Time:02-01

When declaring the following into my build.gradle:

repositories {
    mavenLocal()
}

I can re-deploy similar Maven Artifacts (similar = with the exact same version) to Maven local, Gradle will pick up the latest which has been installed, without the need of using --refresh-dependencies

If, instead of declaring a mavenLocal() repository, I'm declaring a Maven Remote Repository, then I'll have to include --refresh-dependencies in order to be 100% sure I'm getting the latest of a published version. No problem here, this is expected ...

However, I don't understand why the same is not true for a mavenLocal() repository. I couldn't find any explanation in the documentation: Declaring a changing version.

Does anyone have any hints?

CodePudding user response:

Caching is disabled for local repositories.

The paragraph The case for mavenLocal() from the Declaring repositories enumerates the various downsides of using mavenLocal() and explains the behavior you observe:

To mitigate the fact that metadata and/or artifacts can be changed, Gradle does not perform any caching for local repositories

  •  Tags:  
  • Related