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

loud-guitar-4381

03/24/2019, 7:44 PM
Hi, Is there a way to use
JvmToolMixin.register_jvm_tool
with local build targets? Can I pass local scala target as parameter to classpath_spec?
a

aloof-angle-91616

03/24/2019, 7:48 PM
so the way we do this in pants is that i think every jvm tool automatically becomes a target that you can override with a
jar_library()
, and then if you use
mutable=True
and a file:// url you can iterate on the jvm tool sources. we should really really have a way to say “build this jvm target, then let me depend on the output”, but we don’t yet. the new v2 engine will make this easier to implement
👍 1
l

loud-guitar-4381

03/24/2019, 10:45 PM
Thanks! that answers my question. looks like there is no way to do it automatically right now.
I will fallback to using local maven store
a

aloof-angle-91616

03/24/2019, 10:47 PM
it is a major failing, and we have a task in our monorepo which allows us to depend on java and scala library targets by building them first in a pants subprocess, and we should upstream that, but we are working on overhauling the entire jvm pipeline right now, and it may be easier to slot in in a way that doesn’t require invoking a pants subprocess or going through the local maven store as you have done here. it’s extremely useful to be able to just run pants without changes and depend on your own jvm tools
l

loud-guitar-4381

03/24/2019, 10:50 PM
yup. make sense.
a

aloof-angle-91616

03/24/2019, 10:51 PM
if the process of using the local maven store is tedious or presents other issues please make an issue
l

loud-guitar-4381

03/24/2019, 10:52 PM
wondering if I can hack a custom Task in pants plugin which publishes/compiles the targets I want. so I can use them for later in other task.
Thanks I will open a ticket.
a

aloof-angle-91616

03/24/2019, 10:54 PM
yes! pants has codegen capabilities with SimpleCodegenTask and that might be able to do what you want (generating a
jar_library()
for the jvm tool from a
scala_library()
target — there may be a better example)
l

loud-guitar-4381

03/24/2019, 10:55 PM
cool. will try to find the usages in the codebases. (probably tests will have some examples.)
a

aloof-angle-91616

03/24/2019, 10:56 PM
you’ll definitely want to check out https://www.pantsbuild.org/dev.html, especially “developing a task”
👍 1
but also, yes. there are examples in
examples/
and
testprojects/
as well (which all work, since they are executed by our CI on each commit)