Other language support
While Maven does not provide official plugins for most other programming languages, the protobuf-maven-plugin allows you to generate source code for a number of other programming languages.
Languages directly supported by protoc
By default, only Java generation is enabled. You can turn this off if desired.
To enable other languages, use the following attributes within your configuration block;
| Language | Parameter | Default value | Notes |
|---|---|---|---|
| Java | javaEnabled |
true |
|
| Kotlin | kotlinEnabled |
false |
Generates JVM Kotlin descriptors. You should also ensure javaEnabled is true. |
| Python | pythonEnabled |
false |
|
| Python typeshed stubs | pythonStubsEnabled |
false |
Enable this alongside pythonEnabled to generate MyPy-compatible typehint stubs. |
| Ruby | rubyEnabled |
false |
Further support
Any other languages natively available in protoc can be enabled by passing <arguments/> in the plugin configuration. For example:
<configuration>
<arguments>
<argument>--cpp_out=target/generated-sources/cxx</argument>
</arguments>
<protoc kind="binary-maven">
<version>${protobuf.version}</version>
</protoc>
</configuration>
Languages and tooling without first-class support
Any other language integrations can be provided to this plugin in the shape of third-party custom protoc plugins.
See “using protoc plugins” for full details.
Caveats
It is also important to note that you need to provide a valid compiler or tooling to make use of the generared sources (other than Java). For example, Kotlin generation would require you to also configure the kotlin-maven-plugin. See the Kotlin Maven Plugin documentation for details on how to configure your builds for Kotlin.
Kotlin generation only supports the generation of JVM descriptors that compliment the Java outputs. This means you will need both Java and Kotlin compilation in your build. For pure Kotlin support, a third-party protoc plugin is required.

