Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging Grails command "refresh-dependencies" with maven\issues with Nexus

I'm on a corporate network so to retrieve dependencies we use Nexus. Grails repo was added to nexus repositories so now all that is left is to configure grails to use nexus.

For development of Java Maven projects I only had to specify which settings.xml file should it pay attention to as the Nexus URL and credentials were stored there.

Now we're switching to Grails and upon creating a new project grails hangs on Configuring class-path for about 200 seconds (as it is configured to timeout after 200 seconds) and then says:

Resolve error obtaining dependencies: Failed to read artifact descriptor for jline:jline:jar:2.12 (Use --stacktrace to see the full trace)
Error |
Required Grails build dependencies were not found. This is normally due to internet connectivity issues (such as a misconfigured proxy) or missing repositories in grails-app/conf/BuildConfig.groovy. Please verify your configuration to continue.
Process was killed

Now this is probably an issue with repo configuration, however I'm unable to properly debug this.

I've tried calling grails refresh-dependencies --stacktrace, I've tried changing logging from error to debug and trace in Config.groovy. Tried setting logging to verbose in BuildConfig.groovy (but that is for Ivy, and we're using Maven so of course it does nothing), and now I'm unsure as to what to do.

If it helps, here's my current repo config in BuildConfig.groovy:

repositories {
    //inherits true // Whether to inherit repository definitions from plugins       

    grailsPlugins()
    grailsHome()
    mavenLocal()

    mavenRepo(id:'nexusconf', url:"https://nexusurl/repository/rootrepo/") {
        auth username: "user", password: "pass"
    }
    //grailsCentral()
    //mavenCentral()
    // uncomment these (or add new ones) to enable remote dependency resolution from public Maven repositories          
    //mavenRepo "http://repository.codehaus.org"
    //mavenRepo "http://download.java.net/maven/2/"
    //mavenRepo "http://repository.jboss.com/maven2/"
}
like image 588
MrPlow Avatar asked Nov 01 '22 12:11

MrPlow


1 Answers

I think it depends on which version of grails you're using and whether you're using aether or ivy for dependency resolution (set using grails.project.dependency.resolver in the BuildConfig). According to the grails 2.4.4 documentation, to authenticate with Aether, there needs to be configuration in the BuildConfig as well as in USER_HOME/.grails/settings.groovy. To authenticate with Ivy, the configuration goes solely in USER_HOME/.grails/settings.groovy.

Here's what the documentation says:


Authentication with Aether

To authenticate with Aether you can either define the credentials on the repository definition:

mavenRepo(url:"http://localhost:8082/myrepo") { auth username: "foo", password: "bar" }

Or you can specify an id on the repository:

mavenRepo(id:'myrepo', url:"http://localhost:8082/myrepo")

And then declare your credentials in USER_HOME/.grails/settings.groovy:

grails.project.dependency.authentication = { credentials { id = "myrepo" username = "admin" password = "password" } }

Authentication with Ivy

If your repository requires authentication you can configure this using a credentials block:

credentials { realm = ".." host = "localhost" username = "myuser" password = "mypass" }

This can 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" } }

Here's the documentation in its entirety

like image 175
Dan Fischer Avatar answered Nov 13 '22 17:11

Dan Fischer