I have a JVM binary target that looks like:
jvm_binary(
name = "server-binary",
dependencies = [
":server-library",
"static_files:make"
],
main= "Main",
)
I can add command line arguments to the server like so:
./pants run server:server-binary --jvm-run-jvm-program-args='-port:9000'
But I'd like to have to have some arguments be part of the target, so I don't have to specify the arguments on the command line everytime I invoke pants.
Ideally I could type something like:
jvm_binary(
name = "server-binary",
dependencies = [
":server-library",
"static_files:make"
],
main= "Main",
args = {
"--jvm-run-jvm-program-args": "-port:9000"
}
)
Is there a way to do this?
You can use a
jvm_prep_command()
that depends on yourjvm_library()
targets:Here's an example from our repo:
Run this with
./pants run sms:migrate