bazel-deps icon indicating copy to clipboard operation
bazel-deps copied to clipboard

Take Maven coords instead of YAML

Open cgrushko opened this issue 6 years ago • 6 comments

... well, maybe not instead, both support something like

dependencies:
  'javax.servlet:javax.servlet-api:jar:4.0.0'

Instead of

dependencies:
  javax.servlet:
    javax.servlet-api:
      version: "4.0.0"
      lang: java

cgrushko avatar Aug 29 '17 20:08 cgrushko

supporting both might be nice, but honestly, our main use case is scala, so how would you do the scala? The issue in scala is that the scala version needs to be appended onto the end of the artifact id.

We can figure something out.

Wouldn't your example be: javax.servlet:javax.servlet-api:4.0.0 do we need the :jar there?

johnynek avatar Sep 01 '17 21:09 johnynek

I was copy-pasting a bunch of coords from https://mvnrepository.com/, where you can request the UI to print the coords in various ways.

For projects with dozens of dependencies this might be an extra hurdle.

I don't know much about maven coords, I admit. I'd expect the :jar to be added by default by Maven itself.

cgrushko avatar Sep 01 '17 23:09 cgrushko

jar is an optional packaging type. For others it's mandatory. There's also classifier and I think something else.

ittaiz avatar Sep 06 '17 05:09 ittaiz

Looked at this again, indeed I was missing a :jar somewhere in there.

My plan is to leverage mvn dependency:tree to print all dependencies in a pom.xml file and any submodules, and then more or less copy-paste the result into the YAML file that bazel-deps consumes.

@johnynek do you have a preference of how this looks like? do I allow strings instead of MavenGroup objects? or should I create a separate section (dependencies-coords?) in the YAML file? Also, if you can give me code pointers of how to do this it'll save me a lot of time fighting with Scala :)

cgrushko avatar Sep 25 '17 10:09 cgrushko

have you looked at this:

https://github.com/johnynek/bazel-deps/blob/master/src/scala/com/github/johnynek/bazel_deps/maven/Tool.scala#L326

which can generate WORKSPACES and BUILDs from poms?

johnynek avatar Sep 27 '17 01:09 johnynek

it would be nice to document that more and maybe unify it with the main tool, but it seemed separate enough.

johnynek avatar Sep 27 '17 01:09 johnynek