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

failed compile ...Validator.java file #191

Closed
dimax0505 opened this issue May 14, 2019 · 20 comments
Closed

failed compile ...Validator.java file #191

dimax0505 opened this issue May 14, 2019 · 20 comments
Labels
Bug Reports and/or fixes a bug Java Java/JVM language support

Comments

@dimax0505
Copy link

I would to try your PGV plugin for validation protobuf messages (lang=java), but i can't compile my project. I faced with error:
[INFO] --- protobuf-maven-plugin:0.5.0:test-compile-custom (protoc-java-pgv) @ pgv-java-grpc ---
[INFO] Compiling 1 proto file(s) to C:\Users\Maksimov-DE\go\src\github.com\envoyproxy\protoc-gen-validate\java\pgv-java-grpc\target\generated-test-sources\protobuf\java-pgv
[ERROR] PROTOC FAILED: C:\Users\Maksimov-DE\go\src\github.com\envoyproxy\protoc-gen-validate\java\pgv-java-grpc\target\generated-test-sources\protobuf\java-pgv/io\envoyproxy\pgv\grpc\HelloValidator.java: No such file or directory

[ERROR] C:\Users\Maksimov-DE\go\src\github.com\envoyproxy\protoc-gen-validate\java\pgv-java-grpc\src\test\proto\hello.proto [0:0]: C:\Users\Maksimov-DE\go\src\github.com\envoyproxy\protoc-gen-validate\java\pgv-java-grpc\target\generated-test-sources\protobuf\java-pgv/io\envoyproxy\pgv\grpc\HelloValidator.java: No such file or directory

I try to run test from you repo - pgv-gava-jrpc with same error... Can you say, what i do wrong?

@rmichela
Copy link
Contributor

It looks like you are compiling on Windows. How are you building PGV?

@dimax0505
Copy link
Author

dimax0505 commented May 15, 2019

Yes, I cloned your project, and build PGV localy on Windows.

@rmichela
Copy link
Contributor

I think I fixed this in a PR #186 I'm working on. Since you have a local clone, can you verify by changing line 126 of templates/java/register.go to

fullPath := strings.Replace(javaPackage(f), ".", string(os.PathSeparator), -1)

https://github.com/envoyproxy/protoc-gen-validate/pull/186/files#diff-7861baaaa3aaaaead65cf98ebb8cc3e1R126

@dimax0505
Copy link
Author

Now i clone rmichela:bugfix/java-multiple-files and have same error...
fullPath := strings.Replace(javaPackage(f), ".", string(os.PathSeparator), -1) - correctly now...

@rodaine rodaine added Bug Reports and/or fixes a bug Java Java/JVM language support labels May 15, 2019
@dimax0505
Copy link
Author

dimax0505 commented May 16, 2019

I haven't figered out yet, how to implement validatoin function to my own applycation (spring boot grpc hello server), but pgv-java-grpc module passed test successful now. I compiled PGV with corrected func JavaMultiFilePath in register.go like this -
func JavaMultiFilePath(f pgs.File, m pgs.Message) pgs.FilePath {
//fullPath := strings.Replace(javaPackage(f), ".", string(os.PathSeparator), -1)
fileName := classNameMessage(m) + "Validator.java"
filePath := pgs.JoinPaths(/*fullPath, */ fileName)
return filePath
}
if you have some instructions how integrate validator in my application, I would be thanckfull!

@skyrocknroll
Copy link

@rmichela Any hints on how to integrate pgv into java application would be really helpful. I am able to successfully compile and it generated java-pgv packages. There is no clue on how to integrate with grpc service implementation.

@skyrocknroll
Copy link

#202

@rmichela
Copy link
Contributor

@dimax0505 Can you try now with the latest -SNAPSHOT release?

@dimax0505
Copy link
Author

https://oss.sonatype.org/content/repositories/snapshots/io/envoyproxy/protoc-gen-validate/ i add dependency from this repository, but have same error...

@skyrocknroll
Copy link

@dimax0505 did you do mvn clean compile -U to force update the snapshot?

@dimax0505
Copy link
Author

yes:
[INFO] --- protobuf-maven-plugin:0.6.1:test-compile-custom (protoc-java-pgv) @ pgv-java-grpc ---
Downloading: https://oss.sonatype.org/content/repositories/snapshots/io/envoyproxy/protoc-gen-validate/protoc-gen-validate/0.1.0-SNAPSHOT/maven-metadata.xml
Downloading: https://repo.maven.apache.org/maven2/io/envoyproxy/protoc-gen-validate/protoc-gen-validate/0.1.0-SNAPSHOT/maven-metadata.xml
Downloading: http://repository.sonatype.org/content/repositories/releases/io/envoyproxy/protoc-gen-validate/protoc-gen-validate/0.1.0-SNAPSHOT/maven-metadata.xml
Downloading: https://oss.sonatype.org/content/repositories/snapshots/io/envoyproxy/protoc-gen-validate/protoc-gen-validate/0.1.0-SNAPSHOT/maven-metadata.xml
Downloaded: https://oss.sonatype.org/content/repositories/snapshots/io/envoyproxy/protoc-gen-validate/protoc-gen-validate/0.1.0-SNAPSHOT/maven-metadata.xml (4 KB at 3.7 KB/sec)
Downloaded: https://oss.sonatype.org/content/repositories/snapshots/io/envoyproxy/protoc-gen-validate/protoc-gen-validate/0.1.0-SNAPSHOT/maven-metadata.xml (4 KB at 3.7 KB/sec)
Downloading: https://oss.sonatype.org/content/repositories/snapshots/io/envoyproxy/protoc-gen-validate/protoc-gen-validate/0.1.0-SNAPSHOT/protoc-gen-validate-0.1.0-20190526.214922-6.pom
Downloaded: https://oss.sonatype.org/content/repositories/snapshots/io/envoyproxy/protoc-gen-validate/protoc-gen-validate/0.1.0-SNAPSHOT/protoc-gen-validate-0.1.0-20190526.214922-6.pom (10 KB at 19.4 KB/sec)
Downloading: https://oss.sonatype.org/content/repositories/snapshots/io/envoyproxy/protoc-gen-validate/protoc-gen-validate/0.1.0-SNAPSHOT/protoc-gen-validate-0.1.0-20190526.214922-6-windows-x86_64.exe
Downloaded: https://oss.sonatype.org/content/repositories/snapshots/io/envoyproxy/protoc-gen-validate/protoc-gen-validate/0.1.0-SNAPSHOT/protoc-gen-validate-0.1.0-20190526.214922-6-windows-x86_64.exe (11446 KB at 1964.2 KB/sec)
[INFO] Compiling 1 proto file(s) to C:\Users\17318390\IdeaProjects\protoc-gen-validate\java\pgv-java-grpc\target\generated-test-sources\protobuf\java-pgv
[ERROR] PROTOC FAILED: C:\Users\17318390\IdeaProjects\protoc-gen-validate\java\pgv-java-grpc\target\generated-test-sources\protobuf\java-pgv/io\envoyproxy\pgv\grpc\asubpackage\HelloRequestValidator.java: No such file or directory

[ERROR] C:\Users\17318390\IdeaProjects\protoc-gen-validate\java\pgv-java-grpc\src\test\proto\hello.proto [0:0]: C:\Users\17318390\IdeaProjects\protoc-gen-validate\java\pgv-java-grpc\target\generated-test-sources\protobuf\java-pgv/io\envoyproxy\pgv\grpc\asubpackage\HelloRequestValidator.java: No such file or directory

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.246 s
[INFO] Finished at: 2019-05-27T09:13:19+03:00
[INFO] Final Memory: 15M/209M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.xolstice.maven.plugins:protobuf-maven-plugin:0.6.1:test-compile-custom (protoc-java-pgv) on project pgv-java-grpc: protoc did not exit cleanly. Review output for more information. -> [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

@rmichela
Copy link
Contributor

There is a forward slash between java-pgv and io/envoyproxy. Is that what is causing the problem?

@dimax0505
Copy link
Author

yes... but now, i change com.google.protobuf:protoc:3.6.1 to 3.8.0 and error disappear... i don't undestand it... I will try test it on my app in local network, one qwestion - were artefacts in repo https://oss.sonatype.org/content/repositories/snapshots/io/envoyproxy/protoc-gen-validate been generated from master branch of current project?

@rmichela
Copy link
Contributor

Yes. Everything is built from master.

@rmichela
Copy link
Contributor

i change com.google.protobuf:protoc:3.6.1 to 3.8.0 and error disappear

I have no way to reproduce your problem, but the fact that upgrading protoc fixed your build makes me think this is a bug in protoc and not PGV. @rodaine, what do you think?

@rmichela
Copy link
Contributor

@keith Are you also having trouble building on Windows with protoc 3.6.1?

@rodaine
Copy link
Member

rodaine commented Jun 20, 2019

@rodaine, what do you think?

After fixing the slash issue, what was the error reported by 3.6.1, @dimax0505?

@dimax0505
Copy link
Author

@rodaine, what do you think?

After fixing the slash issue, what was the error reported by 3.6.1, @dimax0505?

sorry, i don't clear undestend your question...
i try two way - first - #191 (comment) - i change file templates/java/register.go, and now it work in my local project.
second - i change 3.6.1 to 3.8.0...
if you talk about snapshot-0.2.0 - i don't try it yet...

@rmichela
Copy link
Contributor

second - i change 3.6.1 to 3.8.0

Did this fix your problem?

@dimax0505
Copy link
Author

yes, thanks, i closing issue...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Reports and/or fixes a bug Java Java/JVM language support
Projects
None yet
Development

No branches or pull requests

4 participants