Open max-grossmann opened 3 years ago
Okay. I looked into the problem again.
The Problem seems the following:
Private-Token
Value=MyPassword
)AetherResolveSession
implementation in kotlin.script.experimental.dependencies.maven.impl
, which is instantiated by MavenRepositoryCoordinates
, also part of kotlin.script.experimental.dependencies.maven
, which is one of the CompoundDependenciesResolver's specified in DependencyUtil.kt of this libraryrepositorySystemSession
(Part of the AetherResolveSession
)ExternalDependencyResolver
, added it to CompoundDependenciesResolver
, modified some lines to pass the username/password speified in the file:MavenRepository
Annotation to the aether header variable und reused a lot of stuff of MavenDependenciesResolver
and AetherResolveSession
Thanks @MaaxGr for this great analysis.
@ligee Would you agree that this is rather an upstream issue which may be better addressed in kotlin-scripting? To me, an upstream fix seems the best solution here, since with the change-set mentioned above the resolver-API feels a bit cumbersome. Or is it rather a rare edge case in your opinion which should not be supported in kotlin-scripting-resolver?
Of course, it will be better to extend/fix authentication support right in the kotlin-scripting-dependencies-maven
, and I would happily accept a good PR for it to the kotlin repo. :)
But if nobody volunteers, I have already a few auth-related issues in YT, so it most likely will be done at some point.
Thanks, maybe you could point to the corresponding reference YT ticket in case users want upvote the issue.
I'm not quite sure what the best implementation also for the dsl of this library would be:
The Gradle documentation points out, that there are three types of authentication: BasicAuth, DigestAuth and HttpHeaderAuth https://docs.gradle.org/current/userguide/declaring_repositories.html#sec:authentication_schemes
In gradle we have to specify explicitly, which type of authentication should be used.
How should kscript handle this matter:
Hi @MaaxGr @holgerbrandl! The problem with authorization should be fixed in the Kotlin master: https://github.com/JetBrains/kotlin/commit/b77a8228220c272f9f97dbe9673f9e1d14fe3400
The solution was to switch to another transporter factory (from HTTP to Wagon) that actually supports username and password in the authorization.
MavenRepositoryCoordinates
are considered deprecated now, please use Options
instead. Usage example is given here in the test: https://github.com/JetBrains/kotlin/commit/b77a8228220c272f9f97dbe9673f9e1d14fe3400#diff-7e5be2a922d8dcb241e12de7e8a63130f727a8a4da27a7ffb7ff461563b723feR90-R101
@holgerbrandl Could you please try it with other repositories?
I would certainly extend the test suite, but I don't know any other repos with authentication which I could use here.
Hi! I don't manage to include a private maven repository from gitlab maven repos (https://docs.gitlab.com/ee/user/packages/maven_repository)
Using the library from gradle in intellij works, but not with kscript dependencies. Is this currently supported? Details below.
Thank you very much!
Snippet from .kts-File:
Error from kscript:
Working gradle code: