I have a private repository under user X and repository name Y:
This a Java project built with Gradle.
The Gradle configuration file has been configured as explained in the official Github Package Registry documentation and I am able to publish my package with success:
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/X/Y")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_PACKAGE_REGISTRY_USER")
password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_PACKAGE_REGISTRY_API_KEY")
}
}
}
publications {
github(MavenPublication) {
groupId = 'A'
artifactId = 'B'
version = '1.0.0'
from(components.java)
}
}
}
As you can see in the configuration above, I used respectively A and B for the groupId and artifactId. The version is 1.0.0.
My issue is about retrieving this private dependency from another Gradle project. This project has a specific repositories configuration as follows:
repositories {
jcenter()
maven {
url = 'https://maven.pkg.github.com/X/Y'
credentials {
username System.getenv("GITHUB_PACKAGE_REGISTRY_USER")
password System.getenv("GITHUB_PACKAGE_REGISTRY_API_KEY")
}
}
}
and I added the dependency as follows:
implementation 'A:B:1.0.0'
but Gradle could not resolve the dependency.
The repository URL (https://maven.pkg.github.com/X/Y) seems OK since I can open it on my browser with the right credentials. Unfortunately, I cannot browse the hierarchy.
I noticed something weird when I open the package summary page on Github website. Also, the artifact was published under groupId A and artifactId B, it shows the following installation instructions:
<dependency>
<groupId>com.github.X/Y</groupId>
<artifactId>A.B</artifactId>
<version>1.0.0</version>
</dependency>
I tried to change my dependency import to:
implementation 'com.github.X/Y:A.B:1.0.0'
but it could not be resolved again.
I also tried with no success the following as a repository URL:
How could I use a private Github Package Repository artifact from another Gradle project? What is wrong with my current setup?
implementation
. The Github installation on Github pages instructions were wrong... hopefully, they fix them since I created and reported the issue. – Jepum