Reputation: 439
I'm trying to set up the shadow jar plugin for use in my Gradle project. As according to the instructions, I'm importing it like so:
plugins {
id 'com.github.johnrengelman.shadow' version '4.0.2'
}
However, when the build starts, I get the following error:
Plugin [id: 'com.github.johnrengelman.shadow', version: '4.0.2'] 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 'com.github.johnrengelman.shadow:com.github.johnrengelman.shadow.gradle.plugin:4.0.2')
Searched in the following repositories:
Gradle Central Plugin Repository
When investigating the stack trace in configure build, I also find this:
org.gradle.internal.resource.transport.http.HttpRequestException: Could not HEAD 'https://plugins.gradle.org/m2/com/github/johnrengelman/shadow/com.github.johnrengelman.shadow.gradle.plugin/4.0.2/com.github.johnrengelman.shadow.gradle.plugin-4.0.2.pom'.
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to plugins.gradle.org:443 [plugins.gradle.org/104.16.175.166, plugins.gradle.org/104.16.173.166, plugins.gradle.org/104.16.172.166, plugins.gradle.org/104.16.171.166, plugins.gradle.org/104.16.174.166] failed: Connection timed out: connect
Based on this, I'm assuming that there is something wrong between my machine and the plugins repository. I'm working behind a corporate proxy, so I'm wondering if there is any workaround?
Edit: Here is the structure for the code of my repository declaration. Due to security concerns, I'd rather not share the actual url:
repositories {
maven { url 'corporate.repo.url.here:port' }
}
Upon double checking, it seems that the repository is correct, and so the plugin should be downloaded to my local Maven repository. It was not, which I assume has to due with my migration to Gradle. Are there any settings in Gradle to handle this?
Upvotes: 2
Views: 5310
Reputation: 439
I figured it out. In settings.gradle, I needed to set the repositories in pluginManagement to override the default behavior of gradle.
pluginManagement {
repositories {
maven {
url 'corporate.repo.url.here'
}
}
}
By default, gradle wants to go to plugins.gradle.org
; however, I suspect that the proxy I'm working behind prevents that. Hence, I need the code above to point it to the network repository.
Upvotes: 2