gpt4 book ai didi

java - 使用 Maven\issues with Nexus 调试 Grails 命令 "refresh-dependencies"

转载 作者:搜寻专家 更新时间:2023-11-01 03:22:09 29 4
gpt4 key购买 nike

我在公司网络上,因此要检索我们使用 Nexus 的依赖项。 Grails repo 已添加到 nexus 存储库,所以现在剩下的就是配置 grails 以使用 nexus。

对于 Java Maven 项目的开发,我只需要指定哪个 settings.xml它应该注意文件,因为 Nexus URL 和凭据存储在那里。

现在我们切换到 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

现在这可能是 repo 配置的问题,但是我无法正确调试它。

我试过调用 grails refresh-dependencies --stacktrace ,我尝试从 error 更改日志记录至 debugtraceConfig.groovy .尝试将日志记录设置为 verboseBuildConfig.groovy (但那是针对 Ivy 的,我们正在使用 Maven,所以它当然什么都不做),现在我不确定该怎么做。

如果有帮助,这是我在 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/"
}

最佳答案

我认为这取决于您使用的是哪个版本的 grails,以及您是使用 aether 还是 ivy 来解决依赖关系(在 BuildConfig 中使用 grails.project.dependency.resolver 进行设置)。根据 grails 2.4.4 文档,要使用 Aether 进行身份验证,需要在 BuildConfig 和 USER_HOME/.grails/settings.groovy 中进行配置。要使用 Ivy 进行身份验证,配置仅在 USER_HOME/.grails/settings.groovy 中进行。

文档是这样说的:


Aether 身份验证

要使用 Aether 进行身份验证,您可以在存储库定义中定义凭据:

mavenRepo(url:"http://localhost:8082/myrepo") {
auth 用户名:“foo”,密码:“bar”
}

或者您可以在存储库上指定一个 id:

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

然后在 USER_HOME/.grails/settings.groovy 中声明您的凭据:

grails.project.dependency.authentication = {
证书 {
id = "myrepo"
用户名 = “管理员”
密码 = "密码"
}
}

Ivy 身份验证

如果您的存储库需要身份验证,您可以使用凭据 block 进行配置:

凭据{
领域=“..”
主机=“本地主机”
用户名 = "我的用户"
密码=“我的密码”
}

这可以使用 grails.project.ivy.authentication 设置放在您的 USER_HOME/.grails/settings.groovy 文件中:

grails.project.ivy.authentication = {
证书 {
领域=“..”
主机=“本地主机”
用户名 = "我的用户"
密码=“我的密码”
}
}

Here's the documentation in its entirety

关于java - 使用 Maven\issues with Nexus 调试 Grails 命令 "refresh-dependencies",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27636919/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com