Skip to content

Instantly share code, notes, and snippets.

View luomoxu's full-sized avatar
:octocat:

luomo luomoxu

:octocat:
  • BeiJing
View GitHub Profile
@luomoxu
luomoxu / init.gradle.kts
Created November 29, 2025 03:17 — forked from bennyhuo/init.gradle.kts
How to config mirrors for repositories in Gradle without changing the source code of your project?
fun RepositoryHandler.enableMirror() {
all {
if (this is MavenArtifactRepository) {
val originalUrl = this.url.toString().removeSuffix("/")
urlMappings[originalUrl]?.let {
logger.lifecycle("Repository[$url] is mirrored to $it")
this.setUrl(it)
}
}
}