Closed MderM closed 5 years ago
This seems to be related to the recent change to split the generated Java classes into their own classes. Surprised we passed CI, I'm seeing similar errors locally.
@dapengzhang0 Any idea why this might be happening?
Discussed with protobuf team, seems a protobuf bug. Seems "option java_multiple_files = true" and message name not in CamelCase triggered the issue. Let me try to reverse this option in the problematic proto files first.
Filed an issue against protobuf protocolbuffers/protobuf#5598. Sent an envoy PR envoyproxy/envoy#5642 to fix the failure on MacOS.
This is also happening on Windows. Is there a snapshot build our something I may use as long as it will take to fix this issue?
@MderM v0.1.12 should be available through maven and should be usable.
@snowp, I would like to have java_outer_classname
option added for every proto file in envoy. This will not only avoid this issue on case-insensitive file systems such as MacOS, but will also avoid potential breakages described below. What's your thought?
An empty foo_bar.proto
will generate FooBar.java
. Later, if adding message FooBar{}
inside foo_bar.proto
, the generated file will be changed to FooBarOuterClass.java
, this will break existing java users. See https://developers.google.com/protocol-buffers/docs/reference/java-generated
so when will the fix be available? Thx.
@dapengzhang0 I'm fine with that. I'm curious about your motivation though: is this just about maintaining best practices or is there a practical reason for doing this?
@snowp
We, grpc-java, will use envoy proto files for grpc client side load balancer libraray, once these .proto files are adopted, we and our users can never update to newer .proto files if the newer had breaking changes in their generated java code. Without these proto options, as these .proto files evolve, the generated java code is prone to have breaking changes, such as FooBar.java
changes to FooBarOuterClass.java
(It's hard to detect unless you use them). This is a risk, because there are so many .proto files and so many message types; and usually when we found that the new proto files break, they could already have been existing for months and too late to revert. cc @ejona86
I'm curious about your motivation though: is this just about maintaining best practices or is there a practical reason for doing this?
Got it, so this is about making the generated java code less likely to cause breaking changes. Makes perfect sense, thanks!
Still getting these errors with HEAD:
[ERROR] /Users/andre.pinto/others/envoy/java-control-plane/api/target/generated-sources/protobuf/java/io/envoyproxy/envoy/config/filter/network/client_ssl_auth/v2/ClientSSLAuth.java:[6,14] class ClientSslAuth is public, should be declared in a file named ClientSslAuth.java
[ERROR] /Users/andre.pinto/others/envoy/java-control-plane/api/target/generated-sources/protobuf/java/io/envoyproxy/envoy/config/rbac/v2alpha/RBAC.java:[6,14] class Rbac is public, should be declared in a file named Rbac.java
[ERROR] /Users/andre.pinto/others/envoy/java-control-plane/api/target/generated-sources/protobuf/java/io/envoyproxy/envoy/config/filter/http/rbac/v2/RBAC.java:[6,14] class Rbac is public, should be declared in a file named Rbac.java
[ERROR] /Users/andre.pinto/others/envoy/java-control-plane/api/target/generated-sources/protobuf/java/io/envoyproxy/envoy/config/filter/http/ip_tagging/v2/IPTagging.java:[6,14] class IpTagging is public, should be declared in a file named IpTagging.java
[ERROR] /Users/andre.pinto/others/envoy/java-control-plane/api/target/generated-sources/protobuf/java/io/envoyproxy/envoy/config/filter/network/rbac/v2/RBAC.java:[6,14] class Rbac is public, should be declared in a file named Rbac.java
[ERROR] /Users/andre.pinto/others/envoy/java-control-plane/api/target/generated-sources/protobuf/java/io/envoyproxy/envoy/config/filter/accesslog/v2/AccessLog.java:[6,14] class Accesslog is public, should be declared in a file named Accesslog.java
[ERROR] /Users/andre.pinto/others/envoy/java-control-plane/api/target/generated-sources/protobuf/java/io/envoyproxy/envoy/config/filter/http/rbac/v2/RBACPerRoute.java:[90,57] cannot access io.envoyproxy.envoy.config.filter.http.rbac.v2.RBAC
bad source file: /Users/andre.pinto/others/envoy/java-control-plane/api/target/generated-sources/protobuf/java/io/envoyproxy/envoy/config/filter/http/rbac/v2/RBAC.java
file does not contain class io.envoyproxy.envoy.config.filter.http.rbac.v2.RBAC
Wanted to use the reference implementation to adapt eureka service discovery to envoy cluster configuration.
When I clone the repo and do a plain maven build on the test module to try the tests, maven fails to compile the generated java files from protoc-plugin.
Using IntelliJ 2018.3 community with Java11 on mac. Also tried setting gRPC version to LATEST/RELEASE and Java8. Always the same outcome.
[INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project api: Compilation failure: Compilation failure: [ERROR] /Users/maikmewes/IdeaProjects/java-control-plane/api/target/generated-sources/protobuf/java/io/envoyproxy/envoy/config/rbac/v2alpha/RBAC.java:[6,14] class Rbac is public, should be declared in a file named Rbac.java [ERROR] /Users/maikmewes/IdeaProjects/java-control-plane/api/target/generated-sources/protobuf/java/io/envoyproxy/envoy/config/filter/network/client_ssl_auth/v2/ClientSSLAuth.java:[6,14] class ClientSslAuth is public, should be declared in a file named ClientSslAuth.java [ERROR] /Users/maikmewes/IdeaProjects/java-control-plane/api/target/generated-sources/protobuf/java/io/envoyproxy/envoy/config/filter/accesslog/v2/AccessLog.java:[6,14] class Accesslog is public, should be declared in a file named Accesslog.java [ERROR] /Users/maikmewes/IdeaProjects/java-control-plane/api/target/generated-sources/protobuf/java/io/envoyproxy/envoy/config/filter/http/ip_tagging/v2/IPTagging.java:[6,14] class IpTagging is public, should be declared in a file named IpTagging.java [ERROR] /Users/maikmewes/IdeaProjects/java-control-plane/api/target/generated-sources/protobuf/java/io/envoyproxy/envoy/config/filter/network/rbac/v2/RBAC.java:[6,14] class Rbac is public, should be declared in a file named Rbac.java [ERROR] /Users/maikmewes/IdeaProjects/java-control-plane/api/target/generated-sources/protobuf/java/io/envoyproxy/envoy/config/filter/http/rbac/v2/RBAC.java:[6,14] class Rbac is public, should be declared in a file named Rbac.java [ERROR] /Users/maikmewes/IdeaProjects/java-control-plane/api/target/generated-sources/protobuf/java/io/envoyproxy/envoy/config/filter/network/rbac/v2/RBACOrBuilder.java:[27,42] cannot access io.envoyproxy.envoy.config.rbac.v2alpha.RBAC [ERROR] bad source file: /Users/maikmewes/IdeaProjects/java-control-plane/api/target/generated-sources/protobuf/java/io/envoyproxy/envoy/config/rbac/v2alpha/RBAC.java [ERROR] file does not contain class io.envoyproxy.envoy.config.rbac.v2alpha.RBAC [ERROR] Please remove or make sure it appears in the correct subdirectory of the sourcepath. [ERROR] /Users/maikmewes/IdeaProjects/java-control-plane/api/target/generated-sources/protobuf/java/io/envoyproxy/envoy/config/filter/network/rbac/v2/RBACOrBuilder.java:[110,52] cannot access io.envoyproxy.envoy.config.filter.network.rbac.v2.RBAC [ERROR] bad source file: /Users/maikmewes/IdeaProjects/java-control-plane/api/target/generated-sources/protobuf/java/io/envoyproxy/envoy/config/filter/network/rbac/v2/RBAC.java [ERROR] file does not contain class io.envoyproxy.envoy.config.filter.network.rbac.v2.RBAC [ERROR] Please remove or make sure it appears in the correct subdirectory of the sourcepath. [ERROR] /Users/maikmewes/IdeaProjects/java-control-plane/api/target/generated-sources/protobuf/java/io/envoyproxy/envoy/config/filter/network/tcp_proxy/v2/TcpProxy.java:[5304,72] cannot access io.envoyproxy.envoy.config.filter.accesslog.v2.AccessLog [ERROR] bad source file: /Users/maikmewes/IdeaProjects/java-control-plane/api/target/generated-sources/protobuf/java/io/envoyproxy/envoy/config/filter/accesslog/v2/AccessLog.java [ERROR] file does not contain class io.envoyproxy.envoy.config.filter.accesslog.v2.AccessLog [ERROR] Please remove or make sure it appears in the correct subdirectory of the sourcepath. [ERROR] /Users/maikmewes/IdeaProjects/java-control-plane/api/target/generated-sources/protobuf/java/io/envoyproxy/envoy/config/filter/http/rbac/v2/RBACPerRoute.java:[90,57] cannot access io.envoyproxy.envoy.config.filter.http.rbac.v2.RBAC [ERROR] bad source file: /Users/maikmewes/IdeaProjects/java-control-plane/api/target/generated-sources/protobuf/java/io/envoyproxy/envoy/config/filter/http/rbac/v2/RBAC.java [ERROR] file does not contain class io.envoyproxy.envoy.config.filter.http.rbac.v2.RBAC [ERROR] Please remove or make sure it appears in the correct subdirectory of the sourcepath. [ERROR] /Users/maikmewes/IdeaProjects/java-control-plane/api/target/generated-sources/protobuf/java/io/envoyproxy/envoy/config/filter/http/ip_tagging/v2/IPTaggingOrBuilder.java:[25,55] cannot access io.envoyproxy.envoy.config.filter.http.ip_tagging.v2.IPTagging [ERROR] bad source file: /Users/maikmewes/IdeaProjects/java-control-plane/api/target/generated-sources/protobuf/java/io/envoyproxy/envoy/config/filter/http/ip_tagging/v2/IPTagging.java [ERROR] file does not contain class io.envoyproxy.envoy.config.filter.http.ip_tagging.v2.IPTagging [ERROR] Please remove or make sure it appears in the correct subdirectory of the sourcepath. [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
May you have advise on what I'm missing?