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

freezing-xylophone-6667

01/06/2020, 9:20 PM
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

witty-crayon-22786

01/06/2020, 9:21 PM
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

freezing-xylophone-6667

01/06/2020, 9:21 PM
Ahh that’s good to know
w

witty-crayon-22786

01/06/2020, 9:21 PM
the
scala_jar
/
jar
definitions have arguments that define which artifacts to resolve
f

freezing-xylophone-6667

01/06/2020, 9:22 PM
I was looking at that list, have it in front of me in fact
w

witty-crayon-22786

01/06/2020, 9:22 PM
f

freezing-xylophone-6667

01/06/2020, 9:22 PM
ext
may be what I need?
w

witty-crayon-22786

01/06/2020, 9:23 PM
classifier
, probably
f

freezing-xylophone-6667

01/06/2020, 9:29 PM
That fixed it! Thank you for clearing that up for me. I think my eyes were glazing after converting between so many systems