'Gradle cannot resolve dependencies

In my project, I include sources of the Gradle plugin directly (for testing purposes), so when resolving the plugin's dependencies, Gradle uses only gradlePluginPortal(), not mavenCentral(), which is expected.

However, Gradle cannot resolve the plugin's dependencies:

A problem occurred configuring root project 'IntelliJ Platform Plugin Template'.
> Could not resolve all files for configuration ':classpath'.
   > Could not find structure-intellij-3.218.jar (org.jetbrains.intellij.plugins:structure-intellij:3.218).
     Searched in the following locations:
         https://plugins.gradle.org/m2/org/jetbrains/intellij/plugins/structure-intellij/3.218/structure-intellij-3.218.jar
   > Could not find structure-base-3.218.jar (org.jetbrains.intellij.plugins:structure-base:3.218).
     Searched in the following locations:
         https://plugins.gradle.org/m2/org/jetbrains/intellij/plugins/structure-base/3.218/structure-base-3.218.jar

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

But when I access jar's URL directly, it's there:

curl -IL https://plugins.gradle.org/m2/org/jetbrains/intellij/plugins/structure-intellij/3.218/structure-intellij-3.218.jar

HTTP/1.1 303 See Other
Date: Fri, 13 May 2022 06:20:17 GMT
Content-Length: 0
Connection: keep-alive
Location: https://repo.gradle.org/artifactory/jcenter/org/jetbrains/intellij/plugins/structure-intellij/3.218/structure-intellij-3.218.jar
Cache-Control: public, max-age=43200
...

HTTP/1.1 200 OK
Date: Fri, 13 May 2022 06:20:17 GMT
Content-Type: application/java-archive
Content-Length: 195193
...

What could be the issue that Gradle can't handle these dependencies?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source