无法在Intellij中导入Gradle的ShadowJar插件

无法在Intellij中导入Gradle的ShadowJar插件,gradle,intellij-idea,gradle-plugin,shadowjar,Gradle,Intellij Idea,Gradle Plugin,Shadowjar,我正在尝试设置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

我正在尝试设置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
在调查configure build中的堆栈跟踪时,我还发现:

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
基于此,我假设我的机器和插件库之间有问题。我在一家公司代理的背后工作,所以我想知道是否有解决办法

编辑:以下是我的存储库声明代码的结构。出于安全考虑,我不想共享实际的url:

repositories {
    maven { url 'corporate.repo.url.here:port' }
}

经过反复检查,似乎存储库是正确的,因此应该将插件下载到本地Maven存储库中。事实并非如此,我想这是因为我迁移到了格拉德尔。Gradle中是否有任何设置可以处理此问题?

我已经解决了。在settings.gradle中,我需要在pluginManagement中设置存储库以覆盖gradle的默认行为

pluginManagement {
    repositories {
        maven {
            url 'corporate.repo.url.here'
        }
    }
}

默认情况下,gradle希望转到
plugins.gradle.org
;然而,我怀疑我背后的代理阻止了这一点。因此,我需要上面的代码将其指向网络存储库。

您的
存储库
声明是什么样子的?我刚刚编辑了这个问题以包含它。我无法输入实际使用的URL,但结构是相同的。为我工作-非常感谢您指出:)!