【问题标题】:How to configure a custom maven repository in Grails 2.2?如何在 Grails 2.2 中配置自定义 maven 存储库?
【发布时间】:2018-08-15 08:43:50
【问题描述】:

我正在尝试从具有用户名密码的自定义存储库中获取依赖项解析以在 Grails 2.2 中工作。

我尝试在我的 BuildConfig.groovy 中添加以下内容

grails.project.dependency.resolver = "maven"
grails.project.ivy.authentication = {
    repositories {
        mavenRepo('https://maven.companyname.com/repository/repository-name') {
            auth([
                    username: 'myusername',
                    password: 'mypassword'
            ])
        }
    }
}

但我得到类似的错误

Caused by: groovy.lang.MissingMethodException: No signature of method: groovy.util.ConfigSlurper$_parse_closure5.auth() is applicable for argument types: (java.util.LinkedHashMap) values: 

我尝试查看https://grails.github.io/grails2-doc/2.2.0/guide/single.html#dependencyRepositories,但它没有告诉我更多信息。它确实说我需要将凭据放在 settings.groovy 中,但这绝对有必要吗?我尝试将凭据放入 mavenRepo 闭包中,但这不起作用。有什么想法吗?

【问题讨论】:

  • 我不知道答案,但是您是否尝试过将“grails.project.ivy.authentication”切换为“grails.project.maven.authentication”之类的东西?

标签: grails grails-2.2 dependency-resolution


【解决方案1】:

Grails 2 - 很久以前...
这样它就在这里工作了。

BuildConfig.groovy:

…
grails.project.dependency.resolver = "ivy"
grails.project.dependency.resolution = {
repositories {
    mavenRepo "https://repo.example.com/myrepo"  
}
…

~/.grails/settings.groovy:

…
grails.project.ivy.authentication = {
        credentials {
                realm = "My Realm"
                host = "repo.example.com"
                username = "user"
                password = "secret"
        }
}
…

【讨论】:

    猜你喜欢
    • 2011-06-23
    • 2016-02-26
    • 1970-01-01
    • 2017-10-31
    • 2013-03-31
    • 2018-01-09
    • 2012-09-16
    • 2014-11-15
    • 1970-01-01
    相关资源
    最近更新 更多