I have a directory that stores all of my proto files at ${basedir}/resources/proto/
, there is a file a.proto
in which imports another proto file via resources/proto/b.proto
. I tried the following configuration but it does not work as intended:
<plugin>
<groupId>com.github.os72</groupId>
<artifactId>protoc-jar-maven-plugin</artifactId>
<version>3.11.4</version>
<executions>
<execution>
<goals>
<goal>run</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<inputDirectories>
<include>${basedir}/resources/proto</include>
</inputDirectories>
<includeDirectories>
<include>${basedir}/resources/proto</include>
</includeDirectories>
<outputTargets>
<outputTarget>
<type>java</type>
<outputDirectory>${project.build.directory}/generated-sources/java</outputDirectory>
</outputTarget>
</outputTargets>
</configuration>
</execution>
</executions>
</plugin>
I'm pretty sure the includeDirectories tag is just extra and does nothing, and my error is [ERROR] /home/${basedir}/resources/proto/a.proto [0:0]: resources/proto/b.proto: File not found.
How can I properly include the protobuf directories so it can compile? I cannot change the proto files as it is a git submodule therefore I need to work around the current situation.
Figured it out, include directory needs to directly include the basedir as the protobuf files tries to discover them through the full path.