Run a Binary Target


Your project is a Thrift server, command-line tool, or other binary target that you want to execute.


The run goal enables you to run Scala, Java, or Python executables. Here's an example:

$ ./pants run myproject:bin

If you need to pass in command-line arguments when running an executable, see Pass Command-line Arguments to an Executable. If you're working on a Scala or Java project and need to pass in JVM options, see Specify JVM Options.


Scala and Java

The run goal will both compile and execute a binary target. For Scala and Java projects, you can run any target with a jvm_binary definition. Here's an example of a BUILD file that would enable you to run a Scala or Java target:


You can also run a Scala or Java binary target without compiling it first, using the run-dirty goal:

$ ./pants run-dirty myproject/src/main/scala:bin


For Python projects, executables are specified using a python_binary definition. Here's an example:


See Also

  • Compile a Library Target
  • Define a JVM Executable
  • Specify a Python Executable (PEX)
  • Pass Command-line Arguments to an Executable
  • Specify JVM Options
Generated by publish_docs from dist/markdown/html/src/docs/common_tasks/run.html 2017-06-23T23:05:41.773305