Search code examples
grailsgroovyconfiguration-filesgrails3

How to configure settings.groovy in order to use several repositories?


I just installed Grails 3.3.0 and I'd like to configure some custom repositories in the ${HOME}/user/.grails/settings.groovy file.

enter image description here

This is what I've done so far (Real URLs have been replaced for <someUrl1|2>):

grails {
  profiles {
    repositories {
      repo1 {
        url = "<someUrl1>"
        snapshotsEnabled = true
      }
      repo2 {
        url = "<someUrl2>"
        snapshotsEnabled = true
      }
    }
  }
}

Now, when I execute grails command on bash (Ubutu 16.04) it always tries to resolve the dependencies from the first repository (<someUrl1>)

Java: jdk8u141

Should this configuration be done like I did?

If not, How could I configure this file in order to use more than one repo for grails?

If having connectivity issues (or whatsoever), the first attempt to connect to the first repository fails, Does Grails tray to access the other ones declared?


Solution

  • Should this configuration be done like I did?

    Yes, according to the documentation

    Does Grails tray to access the other ones declared?

    Yes, the list of repositories are passed into the constructor of this class. https://github.com/grails/grails-core/blob/master/grails-shell/src/main/groovy/org/grails/cli/profile/repository/MavenProfileRepository.groovy#L48