xolstice / protobuf-maven-plugin

Maven Plugin that executes the Protocol Buffers (protoc) compiler
https://www.xolstice.org/protobuf-maven-plugin/
Other
242 stars 79 forks source link

"No proto files to compile" when using <includes> parameter #116

Closed tmulle closed 1 year ago

tmulle commented 1 year ago

I know this project isn't maintained any more but hoping someone might have an idea.

Using the configuration below the plugin finds my source protos in src/main/proto but it doesn't find my base protos to import which we use for compilation.

As soon as I try to use the includes param to specify the location of our expanded dependency, the plugin says "No protos to compile" which isn't true.

Any ideas?

<plugin>
                <groupId>org.xolstice.maven.plugins</groupId>
                <artifactId>protobuf-maven-plugin</artifactId>      
                <version>0.6.1</version>
                <configuration>
                    <protocArtifact>com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier}</protocArtifact> 
                    <pluginId>grpc-java</pluginId>
                    <pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}</pluginArtifact>
                    <protocPlugins>
                        <protocPlugin>
                            <id>quarkus-grpc-protoc-plugin</id>
                            <groupId>io.quarkus</groupId>
                            <artifactId>quarkus-grpc-protoc-plugin</artifactId>
                            <version>3.4.1</version>
                            <mainClass>io.quarkus.grpc.protoc.plugin.MutinyGrpcGenerator</mainClass>
                        </protocPlugin>
                    </protocPlugins>
<!--                    <includes>
                        <include>${project.build.outputDirectory}/protobuf/base/*.proto</include>
                    </includes>-->
                    <checkStaleness>false</checkStaleness>
                </configuration>
                <executions>
                    <execution>
                        <id>compile</id>
                        <goals>
                            <goal>compile</goal>
                            <goal>compile-custom</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <goals>
                            <goal>test-compile</goal>
                            <goal>test-compile-custom</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
tmulle commented 1 year ago

Ok, turns out it was my fault and misread the docs for the protobuf-maven-plugin.

I was using includes when I should've been using:

<additionalProtoPathElements>
                        <additionProtoPathElement>${project.build.directory}/protos/protobuf</additionProtoPathElement>
                    </additionalProtoPathElements>

I found it by cloning the repo for the plugin and stepping through the debugger and realized the error.