Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Java] redefined error #4501

Closed
thinkerou opened this issue Apr 12, 2018 · 4 comments
Closed

[Java] redefined error #4501

thinkerou opened this issue Apr 12, 2018 · 4 comments

Comments

@thinkerou
Copy link

thinkerou commented Apr 12, 2018

My proto file list:

➜  proto git:(dev) ✗ pwd
/Users/thinkerou/Documents/OpenSourceCodes/polyglot/src/main/proto
➜  proto git:(dev) ✗ tree .
.
├── greeting.proto
└── test.proto

0 directories, 2 files

My proto file content:

➜  proto git:(dev) ✗ cat greeting.proto
syntax = "proto3";

package polyglot.greeting;

option java_multiple_files = false;
option java_package = "polyglot.greeting";
option java_outer_classname = "GreetingProto";

message Greeting {
  string message = 1;
}
➜  proto git:(dev) ✗ cat test.proto
syntax = "proto3";

package polyglot.test;

option java_multiple_files = false;
option java_package = "polyglot.test";
option java_outer_classname = "TestProto";

import "google/protobuf/any.proto";
import "google/protobuf/duration.proto";
import "foo.proto";

message TestRequest {
  string message = 1;
  foo.Foo foo = 2;
  int32 number = 3;
}

message TestResponse {
  string message = 1;
  google.protobuf.Any any = 2;
  google.protobuf.Duration duration = 3;
}
➜  proto git:(dev) ✗

Error infos:

src/main/proto/greeting.proto:10:10: "polyglot.greeting.Greeting.message" is already defined in file "greeting.proto".
src/main/proto/greeting.proto:9:9: "polyglot.greeting.Greeting" is already defined in file "greeting.proto".
[main] WARN polyglot.protobuf.ProtocInvoker - [Protoc log] protoc-jar: protoc version: 3.5.1, detected platform: osx-x86_64 (mac os x/x86_64)
@xfxyjwf
Copy link
Contributor

xfxyjwf commented Apr 12, 2018

The error message suggests either the tool you are using to invoke protoc does something wrong, or the configuration of that tool is wrong. You will need to share the content of your pom.xml file or some other build file you are using before someone can suggest a fix.

@thinkerou thinkerou changed the title [Java] redined error [Java] redefined error Apr 13, 2018
@thinkerou
Copy link
Author

thinkerou commented Apr 13, 2018

Thanks @xfxyjwf My project https://github.com/thinkerou/polyglot
reproduce it using the follow:

mvn clean install -U -Dcheckstyle.skip=true -T 4.0C
java -jar target/polyglot-1.0.0-SNAPSHOT.jar --command=list_services --proto_discovery_root=./src/main/proto --add_protoc_includes=.

Oh, I find to use the follow command it's OK a moment ago:

java -jar target/polyglot-1.0.0-SNAPSHOT.jar --command=list_services --proto_discovery_root=./src/main/proto

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Apr 13, 2018

Hmm, it seems you are using a command line tool provided elsewhere. Can you create an issue against that project instead? The owner of that tool should have a better idea about how the tool should work. The error message above suggests the tool is invoking protoc with conflicting protos, but I have no idea where to look at.

@thinkerou
Copy link
Author

OK, thanks again @xfxyjwf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants