Skip to content

Instantly share code, notes, and snippets.

@shibafu528
Created May 14, 2022 08:33
Show Gist options
  • Save shibafu528/19964371c7f894e1a0bf59779105b5f5 to your computer and use it in GitHub Desktop.
Save shibafu528/19964371c7f894e1a0bf59779105b5f5 to your computer and use it in GitHub Desktop.
家の中にプロキシMaven置いてて、そこにリクエストを向けたい時に使うやつ
apply plugin: HomeRepositoryPlugin
class HomeRepositoryPlugin implements Plugin<Gradle> {
private static String HOME_REPOSITORY_URL = "http://192.168.12.36:8081/repository/maven-public/";
void apply(Gradle gradle) {
gradle.allprojects { project ->
project.repositories {
all { ArtifactRepository repo ->
if (repo instanceof MavenArtifactRepository) {
switch (repo.url.toString()) {
case "https://repo.maven.apache.org/maven2/":
case "https://jcenter.bintray.com/":
case "https://maven.google.com":
project.logger.lifecycle "Repository ${repo.url} removed."
remove repo
break
}
}
}
maven {
url HOME_REPOSITORY_URL
if (gradle.gradleVersion >= '7.0') {
allowInsecureProtocol true
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment