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's repository manager.

As a workaround I set up local Arifactory and added proxies for public and private repositories.

I preperated patch that replaces repositories sections of project to local Artifactory cache and fill it with data by:

$ gradle build --refresh-dependencies

Having this should allow me to build project at home without direct connection to intranet.

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

Tags

adb(1), admin(1), android(1), anki(1), ansible(2), aop(1), blog(2), bytecode(1), c(1), css(2), cygwin(2), driver(1), emacs(3), fs(1), git(3), google(1), gradle(1), hardware(1), hg(2), html(1), interview(13), java(4), js(3), lang(2), lighttpd(1), markdown(1), mobile(1), naming(1), oracle(1), print(1), problem(5), python(1), quiz(6), rst(2), security(3), spring(2), sql(2), srs(1), style(1), tls(2), txt(1), unit(1), utils(1), vcs(3), web(2), win(2), windows(1)

Archive