I'm trying to build a Scala project with Pants, bu...
# general
f
I'm trying to build a Scala project with Pants, but I'm having trouble fetching dependencies from our artifact repository using jvm_artifact. How can I add an artifact repository, along with its credentials, to a pants build?
f
Pants uses Coursier to fetch jars. Credentials should be handled by Coursier. https://get-coursier.io/docs/other-credentials
f
Apparently the same applies to Repositories
f
Pants could probably be better in exposing Coursier features in Pants. If setting Coursier config has limitations, please open an issue.
f
Well it seems I need to use an env variable to configure the repos, which isn't great because I can't check those into version control without additional ceremony
f
Pants already seems to support setting the repositories: https://www.pantsbuild.org/docs/reference-coursier#repos
f
oh, cool
f
It would be straightforward to add other options for Coursier invocations. (I.e., add an option to the
coursier
subsystem in Pants and then make sure to pass those options to the
cs
invocation.
(I believe JVM does not have any active contributors right now, so I am phrasing that in an way to encourage a code contribution if the need exists ...)
😢 1
Plumbing options through is a relatively easy change.
f
Yes, but before I get involved in Pants development, I want to make sure it's actually a useful and pleasant to use tool.
So far it's not looking good.
Starting with the name, which is impossible to google for because all you get is advertisements for trousers
f
yeah the name is unfortunate. and it was chosen 10+ years ago at Twitter when v1 was written there.
f
So I set that COURSIER_CREDENTIALS env variable, and
cs fetch
is now able to download the artifact. But I still get
unauthorized
messages from
pants generate-lockfiles
. So it seems like the env variable gets lost somewhere along the way
f
You can set a property file.
~/.config/coursier/credentials.properties
macOS:
~/Library/Application Support/Coursier/credentials.properties
f
I've tried that too and it also didn't work.
oh hold on, it doesn't work with
cs fetch
either, so I must have got the format wrong
yeah, that did make a difference!
Yeah, now it succeeded generating the lockfiles!
Thanks @fast-nail-55400, that was super helpful!
I have to admit I was getting a bit frustrated by this and several other issues 😅 But this was awesome
Now it's crashing while compiling though
OK, I had to add another dependency, which I think is a bug. Anyway, it's now able to compile and run my program
🎉 1