This message was deleted.
# community-support
s
This message was deleted.
g
In such case I just use
repositories { removeIf { .. } ; maven { .. } }
But it's strange if https://repo.maven.apache.org/maven2/ doesn't resolve, Apache Infra team are great at getting thing work reliably. Could you share what error do you get?
btw, it resolves for me right now
but maybe it's from cache
just got
Copy code
<http://repo.maven.apache.org|repo.maven.apache.org>.  83713   IN      CNAME   repo.apache.maven.org.
from 1.1.1.1
i'll ping folks about that
e
well the CNAME itself isn't necessarily an issue (
*.<http://apache.org|apache.org>.
*.<http://maven.org|maven.org>
), but then
<http://repo.apache.maven.org|repo.apache.maven.org>
is answered authoritatively without an A or AAAA record
g
ahh, Chris pinged Sonatype on the issue 10 minutes ago:
fluxo [3:34 AM]
np. i pinged sonatype on the ticket
yaeh,
<http://maven.org|maven.org>
is under Sonatype control
and they broke it
first they broke new search interface at
<http://central.sonatype.com|central.sonatype.com>
, now they broke Central itself
well the CNAME itself isn't necessarily an issue (*.apache.org. → *.maven.org), but then repo.apache.maven.org is answered authoritatively without an A or AAAA record
it's so similar that I first thought that it was cname to itself 😁
anyway removing central by name or url and adding private mirror work fine for normal deps but sometimes has a race for
pluginManagement
unfortunately
e
I tried using an init script
Copy code
val fixupMavenCentralUrl = Action<MavenArtifactRepository> {
    if (url.host.equals("<http://repo.maven.apache.org|repo.maven.apache.org>", ignoreCase = true)) {
        url = uri(url.toString().replace("<http://repo.maven.apache.org|repo.maven.apache.org>", "<http://repo1.maven.org|repo1.maven.org>", ignoreCase = true))
    }
}
beforeSettings {
    buildscript.repositories.withType(MavenArtifactRepository::class, fixupMavenCentralUrl)
    pluginManagement.repositories.withType(MavenArtifactRepository::class, fixupMavenCentralUrl)
}
beforeProject {
    buildscript.repositories.withType(MavenArtifactRepository::class, fixupMavenCentralUrl)
    repositories.withType(MavenArtifactRepository::class, fixupMavenCentralUrl)
}
which fixed my primary build but doesn't seem to apply to included builds
g
included builds have independent
Settings#pluginManagement#repositories
,
Settings#dependencyResolutionManagement#repositories
and
Project#repositories
, so you'll have to apply the fix for each included build
e
I dropped it in
~/.gradle/init.d/fixupMavenCentralUrl.init.gradle.kts
and it only applied to the top-level build, not included builds. if there's a non-invasive way to do that, I haven't found it
g
let me think for a bit, I somehow applied config to included builds from init plugin
i don't see any special handing for included build in the scripts for my previous job, just usual
gradle.beforeSetting { it.dependencyResolutionManagement { .. } }
that was somehow applied to both root build and included build (since i had a clause that added
gradlePluginPortal()
to
build-logic
. IIRC it was mostly on Gradle 7.x at the time I wrote it
e
thanks anyway. I assume Sonatype's gonna fix this soon so it's not that important, I was just hoping for a temporary workaround I could apply to our CI machines for the time being
g
btw it was applied twice: first time only to main
settings.gradle.kts
(when it resolves included builds) and then to both main settings and one from
build-logic
@ephemient, you may want to also add
dependencyResolutionManagement.repositories.withType(MavenArtifactRepository::class, fixupMavenCentralUrl)
to
beforeSettings
if some project use it instead of declaring repos in
build.gradle[.kts]
v
Init scripts should afair also apply to included builds automatically. Where it did not work before 8.0 was when using
--init-script
, but only on
buildSrc
. Included builds should even work then.