Igor Samarskiy
Igor Samarskiy

Reputation: 93

Why can't I download artifact through Gradle?

When gradle tries to download org.springframework.boot', version: '2.1.9.RELEASE' through Gradle Central Plugin Repository It can't do it

FAILURE: Build failed with an exception.
 * Where:
 Build file '/usr/src/app/build.gradle' line: 2
 * What went wrong:
 Plugin [id: 'org.springframework.boot', version: '2.1.9.RELEASE'] was not found in any of the following sources:
 - Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
 - Plugin Repositories (could not resolve plugin artifact 'org.springframework.boot:org.springframework.boot.gradle.plugin:2.1.9.RELEASE')
   Searched in the following repositories:
     Gradle Central Plugin Repository

But when using wget it can pull it

$ wget https://plugins.gradle.org/m2/org/springframework/boot/org.springframework.boot.gradle.plugin/2.1.9.RELEASE/org.springframework.boot.gradle.plugin-2.1.9.RELEASE.pom
 --2020-07-17 13:38:07--  https://plugins.gradle.org/m2/org/springframework/boot/org.springframework.boot.gradle.plugin/2.1.9.RELEASE/org.springframework.boot.gradle.plugin-2.1.9.RELEASE.pom
 Resolving plugins.gradle.org (plugins.gradle.org)... 104.18.190.9, 104.18.191.9, 2606:4700::6812:bf09, ...
 Connecting to plugins.gradle.org (plugins.gradle.org)|104.18.190.9|:443... connected.
 HTTP request sent, awaiting response... 200 OK

Also I tried to use our nexus proxy but it didn't help

pluginManagement {
    repositories {
        maven { url 'https://${NEXUS_LINK}/repository/GradlePluginPortal/' }
        mavenLocal()
    }
}

Upvotes: 2

Views: 2429

Answers (1)

eis
eis

Reputation: 53462

I have had a ton of issues with Gradle regarding this.

Two pointers:

  • run ./gradlew --debug through command line, check for any errors about not being able to connect - gradle does not respect proxy settings elsewhere, you have to supply them yourself in gradle.properties (like this)
  • try having org.gradle.jvmargs=-Djavax.net.debug=ssl in gradle.properties to see if there are SSL issues - I had "SunCertPathBuilderException: unable to find valid certification path to requested target", which was not reported when using any command line debug flags. Fixing that seems to be a pain though.

Upvotes: 4

Related Questions