Oleksandr Gavenko's blog
2017-03-04 23:00 Resolving "Could not resolve all dependencies for configuration" in Gradle when using local Artifactory

In order to be able to build project at home I need access to company repository manager. As temporary workaround I set up local Arifactory, and added proxies for public and private repositories.

After switching to local Arifactory in Gradle repositories section in order to fill Artifactory cache I ran at work:

$ gradle build --refresh-dependencies

Having this should allow to build at home. But unfortunately Gradle v2.13 failed even on public artifact:

$ gradle build --stacktrace

...
FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration ':testCompileClasspath'.
> Could not find spring-integration-core.jar (org.springframework.integration:spring-integration-core:4.1.3.RELEASE).
  Searched in the following locations:
      http://localhost:8081/artifactory/jcenter/org/springframework/integration/spring-integration-core/4.1.3.RELEASE/spring-integration-core-4.1.3.RELEASE.jar

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':testCompileClasspath'.
        at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver.wrapException(ErrorHandlingConfigurationResolver.java:70)
      at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver.access$000(ErrorHandlingConfigurationResolver.java:33)
      at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver$ErrorHandlingResolvedConfiguration.getFiles(ErrorHandlingConfigurationResolver.java:199)
..
Caused by: org.gradle.internal.resolve.ArtifactNotFoundException: Could not find spring-integration-core.jar (org.springframework.integration:spring-integration-core:4.1.3.RELEASE).
Searched in the following locations:
  http://localhost:8081/artifactory/jcenter/org/springframework/integration/spring-integration-core/4.1.3.RELEASE/spring-integration-core-4.1.3.RELEASE.jar
      at org.gradle.internal.resolve.result.DefaultBuildableArtifactResolveResult.notFound(DefaultBuildableArtifactResolveResult.java:38)
      at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository$LocateInCacheRepositoryAccess.resolveArtifactFromCache(CachingModuleComponentRepository.java:260)
      at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository$LocateInCacheRepositoryAccess.resolveArtifact(CachingModuleComponentRepository.java:244)
      at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.BaseModuleComponentRepositoryAccess.resolveArtifact(BaseModuleComponentRepositoryAccess.java:54)
      at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.memcache.InMemoryCachedModuleComponentRepository$CachedAccess.resolveArtifact(InMemoryCachedModuleComponentRepository.java:82)
      at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.resolveArtifact(ErrorHandlingModuleComponentRepository.java:116)
      at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainArtifactResolver.resolveArtifact(RepositoryChainArtifactResolver.java:63)

Actually spring-integration-core-4.1.3.RELEASE.jar is present in Artifactory cache:

bash# curl --head http://localhost:8081/artifactory/jcenter/org/springframework/integration/spring-integration-core/4.1.3.RELEASE/spring-integration-core-4.1.3.RELEASE.jar
HTTP/1.1 200 OK
Server: Artifactory/5.1.0
...

After switching project build to Gradle 3.3 problem disappeared.

It seems that Gradle made some assumption about repository. So I refreshed Gradle cache by running build with --refresh-dependencies:

$ gradle build --refresh-dependencies

and problem went away!

gradle

Feeds

all / emacs / java / python

Tags

admin(1), anki(1), blog(1), css(2), cygwin(2), emacs(3), fs(1), git(2), gradle(1), hg(2), html(1), interview(11), java(2), js(3), lang(2), lighttpd(1), mobile(1), naming(1), oracle(1), print(1), problem(5), quiz(6), rst(1), security(1), sql(2), srs(1), style(1), unit(1), utils(1), vcs(3), web(2), win(2)

Archive