Open baopng opened 3 years ago
What permissions did you generate your API key with?
Thank you for answering. Not sure if I understand correctly but I I authenticated with a deploy token. My colleague gave that token to me and both he and I managed to publish packages using that very token.
So I would reecomend against using a deploy toke, if you are publishing within the gitlab CI the auto generated $CI_JOB_TOKEN should be sufficient and is less of a risk.
Secondly per gitlabs documentation $DEPLOY_TOKENS
don't work with the gitlab api which is what this plugin uses under the hood, so it is likely that is why you can't pull down the package.
Are you trying to pull down the package on your local machine or within another gitlab ci?
If you are trying to get this to work locally I would recommend adding something like this to your sbt file
credentials += Credentials(Path.userHome / ".sbt" / ".credentials.gitlab"),
then creating a gitlab personal access token woth read_api permissions and creating the following file: ~/.sbt/crednetials.gitlab`
realm=gitlab
host=
user=Private-Token
password=
note the host section should be filled in with either gitlab.com or the hostname of the deployed instance of gitlab and password should be filled in with your generated api key
you may also need to set the following in your build.sbt for consuming locally
GitlabPlugin.autoImport.gitlabGroupId := Some(12345)
GitlabPlugin.autoImport.gitlabDomain := "my-gitlab-hostname.com"
Thank you so much for your help. I switched to CI_JOB_TOKEN and followed your instruction and it worked smoothly. Also I want to share that while trying a bunch of random methods, I found that adding
resolvers ++= Seq (
"gitlab" at "https://your-gitlab-maven-url"
)
could also resolve the problem.
baopng ,
I would like to credit your work in some research I am doing, is there a way for me to contact you?
Sure. You can email me at ngogiabaopham@gmail.com
Hello,
I am having the same problem, but I am having no success so far. I am trying to pull a dependency to my local machine.
I have in my .sbt/.credentials
:
realm=gitlab
host=our.company.com
user=Private-Token
password=XXXXXX...
The token has read_api
access.
Then, in my build.sbt
I have:
ThisBuild / useCoursier := false
credentials += Credentials(Path.userHome / ".sbt" / ".credentials")
GitlabPlugin.autoImport.gitlabDomain := "our.company.com"
GitlabPlugin.autoImport.gitlabGroupId := Some(198)
However, it still says my package is not found despite being in the repository of the group. I can assemble the URL for the POM file and when I open it in the browser, the POM is downloaded. What am I missing?
@rabejens Try also:
GitlabPlugin.autoImport.gitlabCredentials := Some(com.gilcloud.sbt.gitlab.GitlabCredentials("Private-Token", "XXXXXX")),
Hi I have successfully published a package to gitlab. The problem is when I try to add it as a dependency, sbt keeps telling me module not found -> unresolved dependencies. I have already added ThisBuild / useCoursier := false and the 4 lines gitlab configs. Could you please help me resolve this issue? Thank you in advance. Regards