mavengradleoauth-2.0

Maven repository with OAuth2 (or any other HTTP header authentification)


I am trying to use a Gitlab repository as private maven repository for my dependencies. The deployment process works fine (similar as described here), but much more simplified).

No I am trying to add the dependency, which does not seem to work. In maven, this seems to be possible (as described here). But in Gradle only BasicAuth or s AWS s3 tokens seem to be supported.

Is there any way to add custom headers to the requests to a maven repository? Or is there any way to use OAuth2-authentification?

If not, can you give me a hint where to start to implement it?


Solution

  • In the meantime, I implemented it in Gradle and the pull request got merged (since some time ago already...): https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:http-header-auth

    So this is possible now using just Gradle.