Gradle Maven身份验证不适用于gradle.properties中的凭据

时间:2019-03-06 12:56:52

标签: android gradle nexus

我目前正在尝试获取Gradle项目以使用公司的内部联系。 经过一番搜索,我发现以下方法可以工作:

repositories {
     maven {
            credentials {
                username= 'MyName'
                password= 'MyPass'
            }
            url 'https://company.com/repository/public/'
        }
    }

但是我不想兑现我的信用,所以我将其作为{放入我的~/.gradle/.gradle.properties中:

nexusUsername=MyName
nexusPassword=MyPass

并将我的build.gradle更改为:

repositories {
     maven {
            credentials {
                username= project.ext["nexusUsername"]
                password= project.ext["nexusPassword"]
            }
            url 'https://company.com/repository/public/'
        }
    }

这时服务器开始使用HTTP 401进行响应。 当我打印它们时,它们仍会出现,并且看起来完全一样。 为什么会发生这种情况,我该如何解决?

0 个答案:

没有答案