ext { springBootVersion = '2.0.4.RELEASE'} repositories { mavenCentral()} dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") classpath("com.google.protobuf:protobuf-gradle-plugin:0.8.5") }}
plugins { id 'java'} apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' apply plugin: 'com.google.protobuf' group 'com.project.grpc.roleservice' version '1.0-SNAPSHOT' sourceCompatibility = 1.8 protobuf { protoc { artifact = "com.google.protobuf:protoc:3.5.1-1"} plugins { grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.16.1' }} generateProtoTasks { all()*.plugins { grpc {} }}} repositories { mavenCentral()} dependencies { compile('org.springframework.boot:spring-boot-starter-data-jpa') compile('org.springframework.boot:spring-boot-starter-web') compile( 'io.grpc:grpc-netty-shaded:1.16.1') compile('io.grpc:grpc-protobuf:1.16.1') compile('io.grpc:grpc-stub:1.16.1') compile 'io.github.lognet:grpc-spring-boot-starter:3.0.0' runtime('org.springframework.boot:spring-boot-devtools') runtime('mysql:mysql-connector-java') testCompile (group: 'junit', name: 'junit', version: '4.12')} my proto file syntaxsyntax="proto3"; package com.project.grpc.roleservice; message UserRequest { string userName=1;} message RoleReply { string userRole=1;} service UserRoleFromServer{ rpc getRoleUser(stream UserRequest) returns (stream RoleReply);} proto file syntax="proto3"; package com.project.grpc.roleservice; message UserRequest { string userName=1;} message RoleReply { string userRole=1;} service UserRoleFromServer{ rpc getRoleUser(stream UserRequest) returns (stream RoleReply);} do i need to add something in build file On Wednesday, October 31, 2018 at 11:50:08 PM UTC+5:30, Kun Zhang wrote: > > Assuming you are using protobuf-maven-plugin > <https://www.xolstice.org/protobuf-maven-plugin/>, it doesn't matter that > the generated files are under /generated-sources. The generated classes > should be added automatically to your build path by the plugin. Just import > them with the proper package names and your source should compile. > If it still doesn't work, you may want to share your whole project source > so that other people can diagnose for you. > > On Tuesday, October 30, 2018 at 3:04:11 AM UTC-7, Passenger wrote: >> >> Using Java >> >> I created a protobuffer . I generated all the classes . The classes were >> generated in project/target directory .Now my java project folder looks >> like this >> >> 1) src >> 2) target >> 3) pom.xml >> >> Proto file - >> >> syntax="proto3"; >> >> option java_multiple_files = true; >> option java_package="com.grpc.project1"; >> >> package com.grpc.project1; >> >> message Person{ >> string first_name=1; >> string last_name=2; >> >> } >> >> message Greeting{ >> string message=1; >> } >> >> service HelloWorldService{ >> >> rpc sayHello(Person) returns (Greeting); >> } >> >> >> >> >> >> >> >> Now src also has sub folder main/java >> and target also has two sub folder - >> 1) /generated-sources/protobuf/grpc-java >> 2)/generated-sources/protobuf/java >> >> >> >> No i want to implement my HelloWorldService class where should I define >> the class ?? >> Inside src/main/java >> or inside >> 1) /generated-sources/protobuf/grpc-java >> 2)/generated-sources/protobuf/java >> >> If I create class inside src/main/java i am unable to extend >> HelloWorldServiceGrpc.HelloWorldServiceImpl niether i am able to import >> target folderbut it is present inside >> /generated-sources/protobuf/grpc-java/com/grpc/project1 >> >> -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscr...@googlegroups.com. To post to this group, send email to grpc-io@googlegroups.com. Visit this group at https://groups.google.com/group/grpc-io. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/b58d8200-0780-46cd-99bb-51603c0f8667%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.