refreshVersions icon indicating copy to clipboard operation
refreshVersions copied to clipboard

Private repositories fail to check

Open rvp-diconium opened this issue 4 years ago • 10 comments

Is your feature request related to a problem? Please describe. Both gradle sync and refreshVersions fail with 401 when using private repositories. It would be great if they were capable of looking into them.

We have declared on the root gradle the company private repositories like usual:

allprojects {
    repositories {
        maven {
            name = "FooBar"
            url = uri("https://maven.pkg.github.com/<owner>/<repo-name>")
            credentials {
                username = localProperties["github.user"] as String? ?: System.getenv("GH_USER")
                password = localProperties["github.access_token"] as String?
                    ?: System.getenv("GH_ACCESS_TOKEN")
            }
        }

but making those dependencies with the underline _ simply crashes the sync task

Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.
ModuleId(group=<group>, name=<artifact>) not found. Searched the following repositories:
- https://dl.google.com/dl/android/maven2/
- https://maven.pkg.github.com/<owner>/<repo-name>/
- https://repo.maven.apache.org/maven2/
- https://jcenter.bintray.com/

and when running ./gradlew refreshVersions we get 401.

<-- 401 Unauthorized https://maven.pkg.github.com/<owner>/<repo-name>/<package-name>/maven-metadata.xml (113ms, 0-byte body)

Describe the solution you'd like The tasks use the provided credentials to properly authenticate with the repos.

Describe alternatives you've considered We're just hardcoding versions now on the buildSrc

rvp-diconium avatar Feb 18 '21 09:02 rvp-diconium

Can you confirm the issue is resolved in the version 0.10.0?

LouisCAD avatar May 13 '21 04:05 LouisCAD

we still get this problem (401 when trying to read maven-metadata.xml from a private artifact on jitpack) on version 0.11.0

aaajanp avatar Aug 11 '21 14:08 aaajanp

@aaajanp Can you show how the repository is defined and in which file?

LouisCAD avatar Aug 11 '21 16:08 LouisCAD

In the main build.gradle file alongside some other repos

allprojects {
    repositories {
        ...
        maven {
            url "https://jitpack.io"
            credentials { username TOKEN }
        }
        ...
    }
}

Do you need anything else that might help? Accessing the dependency itself works fine, it's just the metadata file that gets a 401.

aaajanp avatar Aug 11 '21 22:08 aaajanp

Does it work if you use + as a version instead of _?

LouisCAD avatar Aug 12 '21 08:08 LouisCAD

that does work! did I just miss this in the documentation?

thanks a lot

aaajanp avatar Aug 12 '21 09:08 aaajanp

actually, it does work but then next time buildSrcLibs command overrides it back to _

is there a good solution for this?

aaajanp avatar Aug 12 '21 10:08 aaajanp

I was asking to debug, not suggesting it as a solution. Thanks for your answer.

LouisCAD avatar Aug 12 '21 10:08 LouisCAD

I suggest that you hardcode the version for these private dependencies, because investigating that issue further is not in our current priorities. I'm reopening this issue so we remember to take it into consideration.

LouisCAD avatar Aug 12 '21 10:08 LouisCAD

This would be a good improvement for private jitpack repositories.

guness avatar Oct 06 '21 14:10 guness