Skip to content

Instantly share code, notes, and snippets.

@wscld
Last active January 13, 2022 17:57
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wscld/2b8b56b5bdda746318538418ce8f553f to your computer and use it in GitHub Desktop.
Save wscld/2b8b56b5bdda746318538418ce8f553f to your computer and use it in GitHub Desktop.
fix for deprecated jcenter dependencies: run ./gradlew assembleRelease --init-script ../init.gradle.kts
apply<ReplaceJCenter>()
class ReplaceJCenter : Plugin<Gradle> {
override fun apply(gradle: Gradle) {
gradle.allprojects {
repositories {
all {
if (this !is MavenArtifactRepository || url.toString().contains("jcenter")) {
project.logger.lifecycle("Removing ${(this as? MavenArtifactRepository)?.url ?: name}...")
remove(this)
project.logger.lifecycle("Adding mavenCentral()")
add(mavenCentral())
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment