簡體   English   中英

使用Nexus調試Grails命令“refresh-dependencies”和maven \\ issues

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

我在公司網絡上,以便檢索我們使用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 ,我嘗試在Config.groovy中將記錄從error更改為debugtrace 嘗試在BuildConfig.groovy中將日志記錄設置為verbose (但是對於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,以及您是否使用以太或常春藤進行依賴項解析(使用BuildConfig中的grails.project.dependency.resolver進行設置)。 根據grails 2.4.4文檔,要使用Aether進行身份驗證,需要在BuildConfig以及USER_HOME / .grails / settings.groovy中進行配置。 要使用Ivy進行身份驗證,配置僅在USER_HOME / .grails / settings.groovy中進行。

這是文檔說的內容:


使用以太身份驗證

要使用Aether進行身份驗證,您可以在存儲庫定義上定義憑據:

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

或者您可以在存儲庫中指定id:

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

然后在USER_HOME / .grails / settings.groovy中聲明您的憑據:

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

與常春藤認證

如果您的存儲庫需要身份驗證,您可以使用憑據塊進行配置:

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

可以使用grails.project.ivy.authentication設置將其放在USER_HOME / .grails / settings.groovy文件中:

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

這是完整的文檔

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM