I can’t explain, why Gradle tries to fetch a dependency from Gradle Plugin Portal despite I haven’t listed the portal in the repositories.
It’s about the dependency gradle-git-publish in the project “archiver”
“archiver” is a Gradle plugin which can be built without any problems!
The weirdness begins, if I try to build the parent project, which is using my plugin “archiver”.
When I run ./gradlew in the parent project, the following occurs:
A problem occurred configuring root project 'Breitbandausbaumonitor'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve org.ajoberstar.git-publish:gradle-git-publish:3.0.1.
Required by:
project : > project :archiver
> Could not resolve org.ajoberstar.git-publish:gradle-git-publish:3.0.1.
> Could not get resource 'https://plugins.gradle.org/m2/org/ajoberstar/git-publish/gradle-git-publish/3.0.1/gradle-git-publish-3.0.1.module'.
> Could not HEAD 'https://jcenter.bintray.com/org/ajoberstar/git-publish/gradle-git-publish/3.0.1/gradle-git-publish-3.0.1.module'.
> Read timed out
> Could not resolve org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.2.2.
Required by:
project : > project :archiver > org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.2
> Skipped due to earlier error
So Gradle tries to fetch gradle-git-publish from https://plugins.gradle.org, which fails as it is redirecting to JCenter. But that’s not the point here. I just can’t explain, why Gradle is trying to fetch the dependency from the plugin portal at all, as the only configured repository is mavenCentral().
OK, but I do see your point, given that the dependency isn’t in the plugins block. Weird.
Overall something seems broken with Gradle dependency resolution at the moment. I had assumed it was in the plugin portal, but maybe that’s just the first dependency that Gradle couldn’t resolve in my project, and it’s really all FUBAR’d right now.
But I still do not understand, why Gradle tries to fetch the dependency of my composite build from the Gradle Plugin Portal and not from mavenCentral() as configured.
Because you did not configure mavenCentral() actually.
Repository declarations are not transitive.
Hence the building of the plugin works as there the dependency is taken directly from MavenCentral.
But when you then apply the plugin, the repositories defined for building the plugin are irrelevant.
The same is true if you have some library you build in an included build and then depend on in another build of the composite build.
For the latter you will probably not notice as in the “parent” build you most probably also have mavenCentral() as repository defined.
But for applied plugins, the configured plugin repositories in the settings script are what counts.
And if you there do not have any repositories defined manually, the Gradle Plugin Portal is added automatically and thus the dependencies resolved from there.