我正在尝试使用 Gitlab 存储库作为我的依赖项的私有(private) Maven 存储库。部署过程运行良好(类似于 as described here ),但更加简化)。
不,我正在尝试添加依赖项,但这似乎不起作用。在 Maven 中,这似乎是可能的( as described here )。但在 Gradle 中只有 BasicAuth 或 AWS s3 token seem to be supported .
有什么方法可以将自定义 header 添加到对 Maven 存储库的请求中吗?或者有什么办法可以使用OAuth2-authentification?
如果没有,您能给我一个提示,从哪里开始实现它吗?
最佳答案
The best piece of information我可以得到 2 1/2 岁的信息,它来自 Gradle 核心开发人员:
Currently this is not possible. We want to potentially support more authentication schemes but there are no plans to support OAuth2 at this time.
还有这个3年的 secret Gradle Git Repo Plugin但有一个“大”对应物:
Private maven repos however, aren't easily accessible via the standard maven http interface, or at least I haven't figured out how to get the authentication right. This plugin simply clones the repo behind the scenes and uses it as a local repo, so if you have permissions to clone the repo you can access it.
所以基本上你被困住了。
关于具有 OAuth2(或任何其他 HTTP header 身份验证)的 Maven 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50522734/