List Available Targets

Problem

You want to find out which Pants targets are currently available in your project or in a subfolder within the project.

Solution

Use the list goal and specify a folder containing a BUILD file. This command, for example, would show all targets available in src/python/myproject/example/BUILD:

$ ./pants list src/python/myproject/example:

This command would show all targets available in the src/python/myproject directory as well as in all subdirectories:

$ ./pants list src/python/myproject::

Note the syntactical difference between the single colon and the double colon.

The output from a ./pants list invocation may look something like this:

$ ./pants list server:
server/server:analytics
server/server:bin
server/server:tests

See Also

Generated by publish_docs from dist/markdown/html/src/docs/common_tasks/list_targets.html 2020-06-13T00:50:52.419417