简体   繁体   English

使用Nexus调试Grails命令“refresh-dependencies”和maven \\ issues

[英]Debugging Grails command “refresh-dependencies” with maven\issues with Nexus

I'm on a corporate network so to retrieve dependencies we use Nexus. 我在公司网络上,以便检索我们使用Nexus的依赖项。 Grails repo was added to nexus repositories so now all that is left is to configure grails to use nexus. Grails repo被添加到nexus存储库中,所以现在剩下的就是配置grails以使用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. 为了开发Java Maven项目,我只需要指定它应该注意哪个settings.xml文件,因为Nexus URL和凭据存储在那里。

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: 现在我们切换到Grails并且在创建一个新项目时grails挂起在配置类路径上大约200秒(因为它被配置为在200秒后超时)然后说:

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. 现在这可能是repo配置的问题,但是我无法正确调试它。

I've tried calling grails refresh-dependencies --stacktrace , I've tried changing logging from error to debug and trace in Config.groovy . 我试过调用grails refresh-dependencies --stacktrace ,我尝试在Config.groovy中将记录从error更改为debugtrace 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. 尝试在BuildConfig.groovy中将日志记录设置为verbose (但是对于Ivy,我们正在使用Maven,当然它什么都不做),现在我不确定该怎么做。

If it helps, here's my current repo config in BuildConfig.groovy : 如果它有帮助,这是我在BuildConfig.groovy当前repo配置:

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/"
}

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). 我认为这取决于您使用的是哪个版本的grails,以及您是否使用以太或常春藤进行依赖项解析(使用BuildConfig中的grails.project.dependency.resolver进行设置)。 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. 根据grails 2.4.4文档,要使用Aether进行身份验证,需要在BuildConfig以及USER_HOME / .grails / settings.groovy中进行配置。 To authenticate with Ivy, the configuration goes solely in USER_HOME/.grails/settings.groovy. 要使用Ivy进行身份验证,配置仅在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: 要使用Aether进行身份验证,您可以在存储库定义上定义凭据:

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

Or you can specify an id on the repository: 或者您可以在存储库中指定id:

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

And then declare your credentials in USER_HOME/.grails/settings.groovy: 然后在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设置将其放在USER_HOME / .grails / settings.groovy文件中:

grails.project.ivy.authentication = { credentials { realm = ".." host = "localhost" username = "myuser" password = "mypass" } }

Here's the documentation in its entirety 这是完整的文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM