Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Generation for Dependency Proto Files Despite Using <includeMavenTypes>direct</includeMavenTypes> #141

Open
tanmaybansal22 opened this issue Feb 22, 2024 · 0 comments

Comments

@tanmaybansal22
Copy link

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 direct 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 direct, 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant