Possible to use maven_install with local repository?

434 views
Skip to first unread message

Robert Cauble

unread,
Sep 16, 2022, 3:04:48 PM9/16/22
to bazel-discuss
Hi,

I am using maven_install and attempting to reference a snapshot versioned artifact in my local repo. I tried specifying repositories = [ "file:///home/user/.m2/repository"];

But I get the following error message "Only artifacts downloaded over http(s) are supported".

Are there any plans to support local maven repository? My use case is that I am experimenting with migrating my maven-based to bazel. But I have a number of dependencies on other projects in my org that still use maven. From time to time I need to do a local build with maven of their source and would like to use that in my build.

Thanks,
Rob

Alex Humesky

unread,
Sep 16, 2022, 4:11:03 PM9/16/22
to Robert Cauble, bazel-discuss

"http://username:password@localhost:8081/artifactory/my-repository",

so I would guess that the way around not being able to use "file://" is to host the repo locally (I don't know myself the best or easiest way to do that).


--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/2c2b333d-d3d6-4f8d-8d3b-849259014ddan%40googlegroups.com.

Robert Cauble

unread,
Sep 16, 2022, 9:08:58 PM9/16/22
to Alex Humesky, bazel-discuss
Thanks! I found the following work:

1) mvn install -DcreateChecksum=true (without this you'll get errors about missing sha files).
2) cd ~/.m2/repository
3) python -m http.server

You can then reference the repository simply as "localhost:8000".

Robert Cauble

unread,
Sep 17, 2022, 8:11:18 PM9/17/22
to Alex Humesky, bazel-discuss
This issue was also fixed by updating my rules_jvm_external version. As I mentioned in a different post, I was using an old version from the example here: https://docs.bazel.build/versions/5.1.0/migrate-maven.html

I can now specify a file url in my list of repositories like this:

file:///home/<user>/.m2/repository

Reply all
Reply to author
Forward
0 new messages