Hey pants team, I’ve started learning pants recent...
# general
f
Hey pants team, I’ve started learning pants recently and I’m attempting to setup a simple finatra project. I’ve noticed I’ve had a hard time including test jars in my 3rdparty dependency BUILD file. I haven’t had a lot of luck understanding how to scope the jars correctly. I’m hoping it’s something really simple that I’m missing. In
3rdparty/jvm/BUILD
I have the following:
Copy code
jar_library(
  name="finatratests",
  jars=[
    scala_jar(org='org.scalatest', name='scalatest', rev='3.0.0'),
    scala_jar(org='com.twitter', name='inject-server', rev='19.12.0'),
    scala_jar(org='com.twitter', name='inject-app', rev='19.12.0'),
    scala_jar(org='com.twitter', name='inject-core', rev='19.12.0'),
    scala_jar(org='com.twitter', name='inject-modules', rev='19.12.0'),
  ],
  scope="compile test",
)
However, even though I set
scope="compile test"
it’s not pulling in the test version of the jars. I’ve attempted to append
-tests
to the artifact name and to the rev number to see if that would do it, but the generated path URL is incorrect when I do that. In SBT I’d do the following with the
tests
classifier:
Copy code
libraryDependencies += "com.twitter" %% "inject-server" % versions.finatra % "test" classifier "tests"
Any help would be great! Thanks!
w
the scope argument defines how the consumers of the
jar_library
target will be able to consume it, rather than which artifact to fetch
f
Ahh that’s good to know
w
the
scala_jar
/
jar
definitions have arguments that define which artifacts to resolve
f
I was looking at that list, have it in front of me in fact
w
f
ext
may be what I need?
w
classifier
, probably
f
That fixed it! Thank you for clearing that up for me. I think my eyes were glazing after converting between so many systems