如何配置grails 2.4.0以通过验证解析artifactory中的工件? [英] How to configure grails 2.4.0 to resolve artifacts from artifactory with authentication?

查看:107
本文介绍了如何配置grails 2.4.0以通过验证解析artifactory中的工件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是每隔几个月发生一次的问题。
我做了一些grails升级,应用程序无法解决我保护的artifactory存储库中的工件。这次我升级了grails 2.4.0,但问题仍然存在。
我配置了我的仓库,如grails文档中所述(这看起来很过时),但grails无法解决我们的仓库中的依赖关系。它没有正确认证。



所以我最终的问题很多人已经问过:

如何使用maven作为依赖关系解析器来配置grails(当前是2.4.0),以便正确地使用私有maven仓库(artifactory)验证?



这是行不通的:



<$ p (code $ c $ if
$ b $ if $ http://repo.myRepoHost.com/plugins-release-local/,{
auth([
username:reader,
password:readerPw
])




$ b

解决方案

我可以解决这个问题,并发现为什么我总是遇到需要身份验证的artifactory存储库。



有一个http头artifactory的状态问题。
如果你已经用管理 - >安全 - >常规 - >允许匿名访问复选框(未选中)使你的整个artifactory保持私有状态,那么所有东西都可以工作,因为artifactory响应一个http状态代码401需要授权,而grails执行另一个请求与您的配置的授权证书正常工作。



如果您选中了复选框(因为你拥有像我这样的私人和公共仓库),你会感到麻烦,因为artifactory不再以401状态码作为响应。相反,即使存储库中只有
工件,并且只有匿名人员无法访问它,它也会以404 Not Found作为响应。在access.log中,您可以在这种情况下找到DOWNLOAD DENIED,并且由于404状态码,grails不会使用配置的凭证发出第二个请求。



已经为公共和私人存储库创建了独立的artifactory实例,或者我们必须为grails实现一个新的配置选项,以支持所选存储库中的始终验证功能。我会通过grails bugtracker向grails开发团队提出这个建议,我还会寻找artifactory开发人员为此构建一个解决方案选项。


It's a problem which every few months occurs. I do some grails upgrades and the app can't resolve my artifacts from my secured artifactory repository. This time i did an upgrade to grails 2.4.0 and yet again the problem exists. I configured my repository as described in the grails documentation (which seems very outdated) but grails can't resolve my dependencies from our repo. It doesn't authenticate correctly.

So my final questions which many people already have asked:

How to configure grails (current 2.4.0) with maven as dependency-resolver to work with a private maven respository (artifactory) with authentication correctly? What do i have to write to my BuildConfig to get it working?

This doesn't work:

if (Environment.current == Environment.PRODUCTION) {

    if (grails.project.dependency.resolver == "maven") {
        mavenRepo "http://repo.myRepoHost.com/plugins-release-local/", {
            auth([
                username: "reader",
                password: "readerPw"
            ])
        }
    }

}

解决方案

I could solve this problem and found out why i always had problems with artifactory repositories which require authentication.

There is a http header status problem with artifactory. If you've made your whole artifactory private with the Admin-> Security-> General-> Allow Anonymous Access checkbox (unchecked) everything works because artifactory responds with a http status code "401 Authorization Required" and grails does another request with your configured authorization credentials which works fine.

If you've checked the checkbox (because you have both private and public repositories like me) you get intro trouble because artifactory doesn't respond with a 401 status code anymore. Instead it responds with "404 Not Found" even if artifact is in repository and only anonymous doesn't have access to it. In access.log you can find "DOWNLOAD DENIED" in this case and grails doesn't make a second request with the configured credentials because of the 404 status code.

So you've to create seperate artifactory instances for your public and private repositories or we have to implement a new configuration option for grails to support an "always authenticate" feature on chosen repositories. I'll suggest this to the grails development team via grails bugtracker and i will also look for the artifactory developers to build a workaround option for this.

这篇关于如何配置grails 2.4.0以通过验证解析artifactory中的工件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆