Hi, Is there a way to use `JvmToolMixin.register_...
# general
l
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
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
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
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
yup. make sense.
a
if the process of using the local maven store is tedious or presents other issues please make an issue
l
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
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
cool. will try to find the usages in the codebases. (probably tests will have some examples.)
a
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)