Simple library to register protobuf generated classes for runtime reflection.
More details on the topic can be found here
1) Add jitpack.io repository
Gradle (Groovy)
repositories {
maven { url 'https://jitpack.io' }
}
Gradle (Kotlin):
repositories {
maven { url = uri("https://jitpack.io") }
}
Maven
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Gradle (Groovy)
implementation 'com.github.ricantech:protobuf-graalvm-feature:${version}'
Gradle (Kotlin):
implementation("com.github.ricantech:protobuf-graalvm-feature:${version}")
Maven
<dependency>
<groupId>com.github.ricantech</groupId>
<artifactId>protobuf-graalvm-feature</artifactId>
<version>${version}</version>
</dependency>
That's it
Feature should be auto-registered thanks to native-image.properties In case of any troubles, you can try to register the feature manually with:
--features=io.github.ricantech.ProtobufFeature
By default, all classes which extends com.google.protobuf.GeneratedMessageV3
and com.google.protobuf.GeneratedMessageV3.Builder
are registered for runtime reflection.
If you need only subset of the generated classes, you can create file protobug-packages.properties
file under folder resources/features
and define packages to be scanned for the generated classes.
Example file can be found here - At this case we would only register classes within package.a
and package.b