title: How to configure a custom maven repository in Grails 2.2?
body: <p>I am trying to get dependency resolution to work in Grails 2.2 from a custom repository which has username password.</p>
  
  <p>I have tried adding the following in my BuildConfig.groovy </p>
  
  <pre><code>grails.project.dependency.resolver = "maven"
  grails.project.ivy.authentication = {
      repositories {
          mavenRepo('https://maven.companyname.com/repository/repository-name') {
              auth([
                      username: 'myusername',
                      password: 'mypassword'
              ])
          }
      }
  }
  </code></pre>
  
  <p>But I get error like</p>
  
  <pre><code>Caused by: groovy.lang.MissingMethodException: No signature of method: groovy.util.ConfigSlurper$_parse_closure5.auth() is applicable for argument types: (java.util.LinkedHashMap) values: 
  </code></pre>
  
  <p>I tried looking at <a href="https://grails.github.io/grails2-doc/2.2.0/guide/single.html#dependencyRepositories" rel="nofollow noreferrer">https://grails.github.io/grails2-doc/2.2.0/guide/single.html#dependencyRepositories</a> but it does not tell me more information. It does say that I need to put the credentials in settings.groovy but is that absolutely necessary? I tried putting the credentials inside mavenRepo closure but that did not work. Any ideas?</p>