HomeDocs
DocsCommunityTestimonialsUsersGitHubTwitterBlogJobsTermsPrivacyCookies
TermsPrivacyCookies
Hey! These docs are for version 2.8, which is no longer officially supported. Click here for the latest version, 2.17!


## When to add new fields?

Adding new fields is useful when you are already using a target type, but need to store additional metadata for your plugin.

For example, if you're writing a codegen plugin to convert a `protobuf_source` target into Java source files, you may want to add a `jdk_version` field to `protobuf_source`.

If you are instead adding support for a new language, [create a new target type](🔗).

If you want to reduce boilerplate in BUILD files, such as changing default values, use [macros](🔗).

## How to add new fields

First, [define the field](🔗). Then, register it by using `OriginalTarget.register_plugin_field(CustomField)`, like this:



To confirm this worked, run `./pants help protobuf_source`.