Remote Repositories
Grails, when installed, does not use any remote public repositories. There is a default
grailsHome()
repository that will locate the JAR files Grails needs from your Grails installation. If you want to take advantage of a public repository you need to specify as such inside the
repositories
block:
repositories {
mavenCentral()
}
In this case the default public Maven repository is specified. To use the SpringSource Enterprise Bundle Repository you can use the
ebr()
method:
You can also specify a specific Maven repository to use by URL:
repositories {
mavenRepo "http://repository.codehaus.org"
}
Local Resolvers
If you do not wish to use a public Maven repository you can specify a flat file repository:
repositories {
flatDir name:'myRepo', dirs:'/path/to/repo'
}
Custom Resolvers
If all else fails since Grails builds on Apache Ivy you can specify an Ivy resolver:
/*
* Configure our resolver.
*/
def libResolver = new org.apache.ivy.plugins.resolver.URLResolver()
['libraries', 'builds'].each {
libResolver.addArtifactPattern("http://my.repository/${it}/[organisation]/[module]/[revision]/[type]s/[artifact].[ext]")
libResolver.addIvyPattern("http://my.repository/${it}/[organisation]/[module]/[revision]/[type]s/[artifact].[ext]")
}
libResolver.name = "my-repository"
libResolver.settings = ivySettingsresolver libResolver
Authentication
If your repository requires some form of authentication you can specify as such using a
credentials
block:
credentials {
realm = ".."
host = "localhost"
username = "myuser"
password = "mypass"
}
The above can also be placed in your
USER_HOME/.grails/settings.groovy
file using the
grails.project.ivy.authentication
setting:
grails.project.ivy.authentication = {
credentials {
realm = ".."
host = "localhost"
username = "myuser"
password = "mypass"
}
}