Gordolio
Gordolio

Reputation: 1997

Grails global config/dependency resolution

I'm behind a firewall that doesn't allow me to download from grailsCentral or mavenCentral. But there is one specific public maven repository that IT lets me download from (say 'repo.maven.apache.org'). Is there a way to configure grails with a global configuration? Or more specifically to use a repository globally?

Excerpt from BuildConfig.groovy

grails.project.dependency.resolution = {
  inherits 'global'
  log 'warn'

  repositories {
    grailsCentral()
    mavenLocal()
    mavenCentral()
    mavenRepo 'http://repo.grails.org/grails/libs-releases'

    // Normally I would add this line to every project
    //mavenRepo 'http://repo.maven.apache.org/maven2/'
  }
...

Is there a way that I can create a file like ~/.grails/BuildConfig.groovy that has content like the following?

grails.global.dependency.resolution = {
  repositories {
    mavenRepo 'http://repo.maven.apache.org/maven2/'
  }
}

Then this repo would be used for every project.:)

Upvotes: 3

Views: 1480

Answers (2)

Gordolio
Gordolio

Reputation: 1997

I was able to do this using the method posted by @ak-tech (Thank you!)

in ~/.grails/settings.groovy

grails.project.dependency.resolution = {
  repositories {
    mavenRepo 'http://repo.maven.apache.org/maven2'
  }
}

Upvotes: 2

Hernán Erasmo
Hernán Erasmo

Reputation: 371

I believe that if you change BuildConfig.groovy in {your-grails-installation-dir}\src\grails\grails-app\conf\BuildConfig.groovy the way you want, then every time you run

grails> create-app myApp

you should get the BuildConfig.groovy with the changes you want.

Upvotes: 0

Related Questions