protobuf-maven-plugin icon indicating copy to clipboard operation
protobuf-maven-plugin copied to clipboard

[Bug]: Only one module's pb file is generated

Open He-Pin opened this issue 1 month ago • 6 comments

Brief description

I have several modules, but I have to put all the protobuf files in one module, if I put them in several modules, then compilng error.

Steps to reproduce

  1. make a project with 3 modules
  2. put two protobufs in two differnet modules.
  3. reference them in another module
  4. compiling

Error message


Logs


Operating system

macos Darwin Mac.local 25.1.0 Darwin Kernel Version 25.1.0: Mon Oct 20 19:33:36 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T6030 arm64

JDK version

java 21

Maven version

3.9.9

Plugin version

4.0.3

Protoc version

4.33.1

Additional details

I have to put them in the same module

Image

Would you like to contribute a bugfix?

  • [ ] Yes, I'd like to contribute a bugfix!

I've redacted any private information from my responses

  • [x] Yes, there is no sensitive information here.

He-Pin avatar Nov 27 '25 16:11 He-Pin

Can you show your POM? If you've referenced them as a dependency then they should be pulled through.

You mention a compiling error, is this javac or protoc that is failing?

Would be worth cross referencing with the docs at https://ascopes.github.io/protobuf-maven-plugin/dependencies.html#a-simple-example and the integration tests at https://github.com/ascopes/protobuf-maven-plugin/tree/main/protobuf-maven-plugin/src/it if possible to see if there are any differences with what you have locally 🙂

ascopes avatar Nov 27 '25 16:11 ascopes

Image

Java error, the file is not generated.

in both module I have

    <build>
        <plugins>
            <plugin>
                <groupId>io.github.ascopes</groupId>
                <artifactId>protobuf-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

and in parent module's pluginManagement:

                <plugin>
                    <groupId>io.github.ascopes</groupId>
                    <artifactId>protobuf-maven-plugin</artifactId>
                    <version>4.0.3</version>
                    <configuration>
                        <protoc>${protobuf.version}</protoc>
                    </configuration>

                    <executions>
                        <execution>
                            <goals>
                                <goal>generate</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

quite common .

He-Pin avatar Nov 27 '25 19:11 He-Pin

How are you depending on the other module?

ascopes avatar Nov 27 '25 19:11 ascopes

Image

If I put the internal-protocols.proto in the folder of tmcp-persistence module, then it fails, only the shared-protocol.proto is generated.

He-Pin avatar Nov 27 '25 19:11 He-Pin

Think I'm going to need to see a project to get an idea of what is happening. Please could you make a minimal working reproduction that you could upload?

ascopes avatar Nov 27 '25 19:11 ascopes

Yes, but I'm currently very busy implementing the MCP Task at work, so I think I can submit a reproducer next weekend. And thank you very much for keeping this project alive.

And maybe I will update the pekko-grpc project with your plugin too.

I put thoese files in the same place, at least works for now.

He-Pin avatar Nov 27 '25 19:11 He-Pin

new examples

https://github.com/ascopes/protobuf-maven-plugin/tree/main/protobuf-maven-plugin/src/it/java-dependencies

https://github.com/ascopes/protobuf-maven-plugin/tree/main/protobuf-maven-plugin/src/it/java-transitive-dependency-compilation

https://github.com/ascopes/protobuf-maven-plugin/tree/main/protobuf-maven-plugin/src/it/java-direct-dependency-compilation

ascopes avatar Dec 06 '25 12:12 ascopes