【发布时间】:2019-05-01 22:22:40
【问题描述】:
我正在尝试设置 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 中是否有任何设置可以处理这个问题?
【问题讨论】:
-
你的
repositories声明是什么样的? -
我刚刚编辑了问题以包含它。我不能输入实际使用的 URL,但结构是一样的。
标签: gradle intellij-idea gradle-plugin shadowjar