使用Gradle源代码依赖项时如何通过Github进行身份验证?

时间:2019-05-17 00:49:58

标签: github gradle dependency-management

我正在尝试在gradle构建中声明源依赖关系。在settings.gradle中,我定义了:

sourceControl {
    gitRepository("https://github.com/my-organization/myRepo.git") {
        producesModule("com.jrandrews:my-dependency")
    }
}

在build.gradle中,我已经声明:

configurations{ application }

dependencies {
    application('com.jrandrews:my-dependency') { 
        version { branch = 'master' }
    }
}

我已经尝试过对该主题进行多种变体,以尝试声明auth方法和auth属性。 “等级依赖--stacktrace”总是导致以下形式的失败:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':dependencies'.
    ...
Caused by: org.gradle.api.GradleException: Could not locate branch 'master' for Git repository at https://github.com/....
    ...
Caused by: org.eclipse.jgit.api.errors.TransportException: https://github.com/***.git: Authentication is required but no CredentialsProvider has been registered
    at org.eclipse.jgit.api.LsRemoteCommand.execute(LsRemoteCommand.java:222)
    at org.eclipse.jgit.api.LsRemoteCommand.call(LsRemoteCommand.java:161)
    at org.gradle.vcs.git.internal.GitVersionControlSystem.getRemoteRefs(GitVersionControlSystem.java:103)
    ... 136 more

显然,这存在一些开放的错误,但是人们似乎已经成功地使用了这种依赖系统,而且我不敢相信他们都在没有身份验证的情况下这样做。有人知道如何声明该依赖项声明可以使用的身份验证吗?

0 个答案:

没有答案