https://pantsbuild.org/ logo
#general
Title
# general
b

best-nightfall-7221

05/23/2021, 6:56 PM
On pants 1.27, I noticed that
jar_library
has a
managed_dependencies
field, but
scala_library
does not? Would it still work if I passed it in via the payload?
Copy code
class AiqScalaLibrary(ScalaLibrary):
  def __init__(self, java_sources=None, payload=None, managed_dependencies=None, **kwargs):
    if managed_dependencies is not None:
        payload = payload or Payload()
        payload.add_fields({
            'managed_dependencies': PrimitiveField(managed_dependencies),
        })
    super(AiqScalaLibrary, self).__init__(java_sources=java_sources,payload=payload,**kwargs)
I'm trying to use
managed_dependencies
to build a top-level jvm binary, which deps on a scala library, which (deep down) has another scala dep where I want to enforce v1 or v2 of it
@wide-energy-11069 I think I see the issue. Coursier resolve only looks at the global dep manager? The ivy one looks at both the manager for the jar else falls back to global one
Wait nm, I guess that param is unused
w

wide-energy-11069

05/24/2021, 5:58 PM
internally at twitter, we don’t use this feature, so hard to tell. although scala_jar is still a jar. maybe https://github.com/pantsbuild/pants/blob/1.25.x-twtr/testprojects/src/java/org/pantsbuild/testproject/depman/TEST_BUILD offers a bit more info.
b

best-nightfall-7221

05/24/2021, 7:31 PM
ScalaLibrary
is a jvm target right? Here it looks specifically for
JarLibrary
Oh nm, I'm confusing JarLibrary vs JavaLibrary
Maybe a better question to ask: can I pass in
managed_dependencies
to
jvm_binary
? I want to do that so I can build the binary twice, once with pinned v1 and once with pinned v2
w

wide-energy-11069

05/24/2021, 10:13 PM
had no experience in that per se.
can I pass in 
managed_dependencies
 to 
jvm_binary
If not, you can always create an another scala_library with managed deps, assuming managed deps works for scala library.
4 Views