我正在尝试设置 shadow jar 插件以在我的 Gradle 项目中使用。根据说明,我正在像这样导入它:
plugins {
id 'com.github.johnrengelman.shadow' version '4.0.2'
}
但是,当构建开始时,我收到以下错误:
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
在配置构建中调查堆栈跟踪时,我还发现:
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
基于此,我假设我的机器和插件存储库之间有问题。我在公司代理后面工作,所以我想知道是否有任何解决方法?
编辑:这是我的存储库声明代码的结构。由于安全问题,我宁愿不分享实际网址:
repositories {
maven { url 'corporate.repo.url.here:port' }
}
经过仔细检查,存储库似乎是正确的,因此应该将插件下载到我的本地 Maven 存储库。事实并非如此,我认为这是由于我迁移到 Gradle 所致。Gradle 中是否有任何设置来处理这个问题?