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.

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
C++ cppEnabled false
C# csharpEnabled false
Java javaEnabled true
Kotlin kotlinEnabled false Generates JVM Kotlin descriptors. You should also ensure javaEnabled is true.
Objective-C objcEnabled false
PHP phpEnabled false
Python pythonEnabled false
Python typeshed stubs pythonStubsEnabled false Enable this alongside pythonEnabled to generate MyPy-compatible typehint stubs.
Ruby rubyEnabled false
Rust rustEnabled false

Any other language integrations can be provided to this plugin in the shape of third-party custom protoc plugins.

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.