This naming strategy helps mapstruct generate working mapping code between your domain classes and protobuf classes. Both fullblown Java protobuf and protolite classes suported.
Manual mapping needed for
- map<k,v>
- oneof
Add the following section to you maven-compiler-plugin plugin configuration:
<annotationProcessorPaths>
<path>
<groupId>no.entur.mapstruct.spi</groupId>
<artifactId>protobuf-spi-impl</artifactId>
<version>1.0.0-SNAPSHOT</version>
</path>
</annotationProcessorPaths>
<dependencies>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>${org.mapstruct.version}</version>
</dependency>
</dependencies>
Complete example:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<annotationProcessorPaths>
<path>
<groupId>no.entur.mapstruct.spi</groupId>
<artifactId>protobuf-spi-impl</artifactId>
<version>1.0.0-SNAPSHOT</version>
</path>
</annotationProcessorPaths>
</configuration>
<dependencies>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>${org.mapstruct.version}</version>
</dependency>
</dependencies>
</plugin>implementation "org.mapstruct:mapstruct:${mapstructVersion}"
annotationProcessor "org.mapstruct:mapstruct-processor:${mapstructVersion}"
annotationProcessor "no.entur.mapstruct.spi:protobuf-spi-impl:1.0.0"http://mapstruct.org/documentation/stable/reference/html/index.html#using-spi