0

If I add 2 repositories in my build.gradle file, they will be autonamed ("maven" and "maven2") :

repositories {
  maven { url "http://maven.springframework.org/release" }
  maven { url "https://maven.fabric.io/public" }
}

Is there a way to name them explicitely ?

Tristan
  • 8,733
  • 7
  • 48
  • 96

1 Answers1

1

You should just be able to use name

repositories {
  maven {
      url "http://maven.springframework.org/release"
      name 'spring-repo'
  }
  maven {
      url "https://maven.fabric.io/public"
      name 'fabric-repo'
  }
}
tim_yates
  • 167,322
  • 27
  • 342
  • 338
  • Ok, thanks ! I was missing the "new line" separator, not familiar with groovy yet, if u put a ',' or a ';' or even some ':' between attribute and value, it just doesn't work. – Tristan Mar 17 '20 at 15:05
  • `;` should work, but you may need to put the braces back in, ie: `url('http...'); name('woo')` – tim_yates Mar 17 '20 at 15:38
  • BTW, you should use https for all repos, as http is being deprecated – tim_yates Mar 17 '20 at 15:39
  • 1
    ok, thx for the syntax tips ! These repos are just a copy/paste from a popular answer, I'm not using them. https://stackoverflow.com/questions/30114860/multiple-maven-repositories-in-one-gradle-file – Tristan Mar 17 '20 at 15:44
  • @Tristan just checking Have fun! – tim_yates Mar 17 '20 at 15:46