Replies: 5 comments 43 replies
-
|
The protobuf imports should correspond to the protofile paths, so should totally ignore whatever the requested Java package is. The important bit is the regular "package" directive. E.g. # in baz/bar/foo.proto
package abc;
message Foo {
...
}...for this, your import elsewhere should be import "baz/bar/foo.proto"
message Something {
abc.Foo foo = 1;
}Can you confirm the package names are being used correctly, or share a snippet with any redacted naming? |
Beta Was this translation helpful? Give feedback.
-
|
Ok so the issue is that you are depending on the proto files as imports. This assumes you have the corresponding Java classes in that dependency as well if you wish for Java to be able to see them. I probably should go and update that example to make it a little clearer when I have some time. If you look at protobuf-java, you'll observe they package both the protobuf sources and the corresponding classes. This is also the reason why I do not recompile proto sources that were added as a dependency by default. Sorry for the confusion, I thought you were meaning that protoc was failing to resolve them rather than protoc only feeding out the sources for your direct dependencies. In your case there are a few options:
|
Beta Was this translation helpful? Give feedback.
-
|
Yep, indeed.
It's more about IJ not finding them, but I'll probably need the shade for
it.
The descriptor doesn't help, it seems like.
Il ven 3 ott 2025, 09:15 Ash ***@***.***> ha scritto:
… That unused warning is most likely to be expected in that case.
—
Reply to this email directly, view it on GitHub
<#818 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACAZGWFUJFFG5YQG7EUH2QT3VYPC3AVCNFSM6AAAAACH73AMQSVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTINJYGEYTEOI>
.
You are receiving this because you authored the thread.Message ID:
<ascopes/protobuf-maven-plugin/repo-discussions/818/comments/14581129@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
|
Raised GH-824 to try and improve the exception messages from HTTP URLs we discussed here somewhere (I cannot find the thread where I mentioned I'd try to improve those). |
Beta Was this translation helpful? Give feedback.
-
|
Did you manage to resolve your issue? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello.
I'm trying to follow https://ascopes.github.io/protobuf-maven-plugin/dependencies.html#a-simple-example but I'm failing to understand how it work and/or how to use it.
Setup:
Ahas aa.protothat gets packaged asA-<version>-proto.zipand the structure in the ZIP isA/a.proto.Bhas ab.protothat depends ona.proto. For this,b.protodefines aimport A/a.protoand adds the ZIP as Maven dependency.The problem I've is that, during the compilation of the sources of
B, Maven can't find the sources ofA.I think, but I hope that's not the case, the issue may be caused by the fact that
a.protodefinesoption java_package = "foo.a";which doesn't really match the folder structure in the ZIP.I also see a
warning: Import A/a.proto is unused.If I use, instead, this then it works but the import is still ignored.
I can see, though, that
a.protois then available undertarget/protobuf-maven-plugin/generate/generate/archives/A-<version>-proto-<sha>/A/.@ascopes your help would be appreciated :)
Beta Was this translation helpful? Give feedback.
All reactions