Extending CompilerConfig: InvalidProtocolBufferException "cannot find field"
See original GitHub issueI try to extend the CompilerConfig
with the ProtobufMessages
as provided in a PR here (https://github.com/marcoferrer/kroto-plus/pull/13/files).
I migrated all the code, but I can’t seem to solve this error when I run generateProto
on my sample project app
:
Caused by: com.google.protobuf.InvalidProtocolBufferException:
Cannot find field: mpProtobufMessages in message krotoplus.compiler.CompilerConfig
I do have this field in my config.proto
:
// Configuration entries for the 'Multi-Platform Protobuf Messages' code generator.
repeated MpProtobufMessagesGenOptions mp_protobuf_messages = 27;
Also this field is present in CompilerConfig.java
:
public static final int MP_PROTOBUF_MESSAGES_FIELD_NUMBER = 27;
private java.util.List<com.github.marcoferrer.krotoplus.config.MpProtobufMessagesGenOptions> mpProtobufMessages_;
And it is also in the CompilerConfig initialization
case 218: {
if (!((mutable_bitField0_ & 0x00000080) == 0x00000080)) {
mpProtobufMessages_ = new java.util.ArrayList<com.github.marcoferrer.krotoplus.config.MpProtobufMessagesGenOptions>();
mutable_bitField0_ |= 0x00000080;
}
mpProtobufMessages_.add(
input.readMessage(com.github.marcoferrer.krotoplus.config.MpProtobufMessagesGenOptions.parser(), extensionRegistry));
break;
}
In krotoPlusConfig.yaml:
mpProtobufMessages:
- filter:
excludePath:
- google/*
Complete error message from the sample project:
Execution failed for task ':generateProto'.
> protoc: stdout: . stderr: Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: com.google.protobuf.InvalidProtocolBufferException: Cannot find field: mpProtobufMessages in message krotoplus.compiler.CompilerConfig
at com.google.protobuf.util.JsonFormat$ParserImpl.mergeMessage(JsonFormat.java:1348)
at com.google.protobuf.util.JsonFormat$ParserImpl.merge(JsonFormat.java:1308)
at com.google.protobuf.util.JsonFormat$ParserImpl.merge(JsonFormat.java:1190)
at com.google.protobuf.util.JsonFormat$Parser.merge(JsonFormat.java:370)
at com.github.marcoferrer.krotoplus.generators.GeneratorContextKt.getCompilerConfig(GeneratorContext.kt:61)
at com.github.marcoferrer.krotoplus.generators.GeneratorContext.<init>(GeneratorContext.kt:36)
at com.github.marcoferrer.krotoplus.generators.GeneratorKt$contextInstance$2.invoke(Generator.kt:75)
at com.github.marcoferrer.krotoplus.generators.GeneratorKt$contextInstance$2.invoke(Generator.kt)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at com.github.marcoferrer.krotoplus.generators.GeneratorKt.getContextInstance(Generator.kt)
at com.github.marcoferrer.krotoplus.generators.GeneratorKt.initializeContext(Generator.kt:61)
at com.github.marcoferrer.krotoplus.generators.GeneratorKt.initializeContext$default(Generator.kt:59)
at com.github.marcoferrer.krotoplus.KrotoPlusProtoCMain.main(KrotoPlusProtoCMain.kt:32)
... 8 more
--krotoPlus_out: protoc-gen-krotoPlus: Plugin failed with status code 1.
I am unsure what else I could be doing wrong?
Hopefully someone can help me out, been stuck on this wayyy too long.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
WebCompiler suddenly gives a compilerconfig.json error #431
This could be due to a change in the format after this extension ... The error I am receiving is "The system cannot...
Read more >How do I solve 'Web Compiler found an error in ...
My issue turns out to be a missing input file that was supposed to be compiled. Method of attack: Try to compile each...
Read more >Diff - platform/tools/adt/idea - Google Git
elementFinder" area="IDEA_PROJECT" interface="com.intellij.psi. ... + NEWLINE + + "> Could not find method ERROR() for arguments ...
Read more >Web Compiler - Visual Studio Marketplace
A Visual Studio extension that compiles LESS, Sass, JSX, ES6 and CoffeeScript files. See the changelog for changes and roadmap.
Read more >[JDK-8229864] EXCEPTION_ACCESS_VIOLATION
Build process started. Classpath: C:/Users/ddesery/AppData/Local/JetBrains/Toolbox/apps/IDEA-U/ch-0/192.5728.98/plugins/java/lib/jps-launcher.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I understand, thanks again for helping me out, this is solved for now 👍
Looking at the example project I think it might be having issues pulling the snapshot from your local kroto branch.
You can try setting the plugin using an absolute path to your local kroto plugin build.