protoc-jar-maven-plugin
protoc-jar-maven-plugin copied to clipboard
Code Generation for Dependency Proto Files Despite Using <includeMavenTypes>direct</includeMavenTypes>
I'm encountering an issue with the protoc-jar-maven-plugin where it generates code for all .proto files present in the dependencies, despite my intention to use those .proto files for import purposes only.
My configuration uses <includeMavenTypes>direct</includeMavenTypes> to include direct Maven dependencies, expecting that the .proto files from these dependencies would not undergo code generation but are only used for imports.
<properties>
<quickbuf.options>indent=4,allocation=lazy,extensions=embedded,store_unknown_fields=true</quickbuf.options>
<quickbuf.version>1.3.2</quickbuf.version>
</properties>
<plugin>
<groupId>com.github.os72</groupId>
<artifactId>protoc-jar-maven-plugin</artifactId>
<version>3.11.4</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<protocVersion>3.23.2</protocVersion>
<cleanOutputFolder>true</cleanOutputFolder>
<inputDirectories>
<include>src/main/proto</include> <!-- My main project proto directory -->
</inputDirectories>
<includeMavenTypes>direct</includeMavenTypes>
<outputTargets>
<outputTarget>
<type>quickbuf</type>
<pluginArtifact>us.hebi.quickbuf:protoc-gen-quickbuf:${quickbuf.version}</pluginArtifact>
<outputOptions>${quickbuf.options}</outputOptions>
<outputDirectory>src/main/java</outputDirectory>
</outputTarget>
</outputTargets>
</configuration>
</execution>
</executions>
</plugin>
I was expecting that the .proto files from dependencies, specified to be included via <includeMavenTypes>direct</includeMavenTypes>, would only be used for import purposes and not trigger code generation.
Is there something incorrect in my config that's causing this behaviour or is there a known issue with handling imported .proto files that leads to unintended code generation?