You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/01/17 10:00:53 UTC

[GitHub] [dubbo-samples] gakkiyomi opened a new issue #413: 希望能提供dubbo-grpc-compiler gradle的配置例子

gakkiyomi opened a new issue #413:
URL: https://github.com/apache/dubbo-samples/issues/413


   ![image](https://user-images.githubusercontent.com/41406557/149748563-10cc9efd-db26-496e-a7c9-d55acd23bd79.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-samples] jannal commented on issue #413: 希望能提供dubbo-grpc-compiler gradle的配置例子

Posted by GitBox <gi...@apache.org>.
jannal commented on issue #413:
URL: https://github.com/apache/dubbo-samples/issues/413#issuecomment-1018152653


   gradle插件目前不支持mainClass方式,我的解决方式是在build.gradle同即目录下新建一个protobuf-pom.xml,然后mvn clean compile -f protobuf-pom.xml 来生成
   ```
   <?xml version="1.0" encoding="UTF-8"?>
   <project xmlns="http://maven.apache.org/POM/4.0.0"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
       <groupId>cn.jannal.dubbo3</groupId>
       <version>1.0.0-SNAPSHOT</version>
       <modelVersion>4.0.0</modelVersion>
       <artifactId>dubbo-demo-protobuf</artifactId>
       <packaging>jar</packaging>
   
       <dependencyManagement>
           <dependencies>
               <dependency>
                   <groupId>org.apache.dubbo</groupId>
                   <artifactId>dubbo-bom</artifactId>
                   <version>3.0.5</version>
                   <type>pom</type>
                   <scope>import</scope>
               </dependency>
           </dependencies>
       </dependencyManagement>
   
   
       <dependencies>
   
           <dependency>
               <groupId>org.apache.dubbo</groupId>
               <artifactId>dubbo</artifactId>
           </dependency>
           <dependency>
               <groupId>io.grpc</groupId>
               <artifactId>grpc-protobuf</artifactId>
           </dependency>
   
           <dependency>
               <groupId>io.grpc</groupId>
               <artifactId>grpc-stub</artifactId>
           </dependency>
           <dependency>
               <groupId>com.google.protobuf</groupId>
               <artifactId>protobuf-java-util</artifactId>
           </dependency>
       </dependencies>
   
   
   
       <build>
           <extensions>
               <extension>
                   <groupId>kr.motd.maven</groupId>
                   <artifactId>os-maven-plugin</artifactId>
                   <version>1.7.0</version>
               </extension>
           </extensions>
           <plugins>
               <!--maven只负责生成protobuf代码,所以不能设置编译src/main/java-->
               <plugin>
                   <artifactId>maven-compiler-plugin</artifactId>
                   <version>3.3</version>
                   <configuration>
                       <source>1.8</source>
                       <target>1.8</target>
                       <!-- 不编译和复制类 -->
                       <excludes>
                           <exclude>**/*.java</exclude>
                       </excludes>
                   </configuration>
               </plugin>
               <!-- grpc代码生成插件 , protoc-gen-dubbo-java 支持 gRPC 和 Dubbo 两种协议-->
               <plugin>
                   <groupId>org.xolstice.maven.plugins</groupId>
                   <artifactId>protobuf-maven-plugin</artifactId>
                   <version>0.6.1</version>
                   <configuration>
                       <!--v3.19.1 有bug,isStringEmpty未公开-->
                       <protocArtifact>com.google.protobuf:protoc:3.17.3:exe:${os.detected.classifier}</protocArtifact>
                       <pluginId>grpc-java</pluginId>
                       <pluginArtifact>io.grpc:protoc-gen-grpc-java:1.31.1:exe:${os.detected.classifier}</pluginArtifact>
                       <outputDirectory>src/main/dubbo</outputDirectory>
                       <!--默认是grpc-->
                       <pluginParameter>grpc</pluginParameter>
                       <clearOutputDirectory>false</clearOutputDirectory>
                       <protocPlugins>
                           <protocPlugin>
                               <id>dubbo-grpc</id>
                               <groupId>org.apache.dubbo</groupId>
                               <artifactId>dubbo-compiler</artifactId>
                               <!--0.0.2和0.0.3都会报错Could not find resource DubboGrpcInterfaceStub.mustache-->
                               <version>0.0.1</version>
                               <mainClass>org.apache.dubbo.gen.grpc.DubboGrpcGenerator</mainClass>
                           </protocPlugin>
                       </protocPlugins>
                   </configuration>
                   <executions>
                       <execution>
                           <goals>
                               <goal>compile</goal>
                               <goal>compile-custom</goal>
                               <goal>test-compile</goal>
                               <goal>test-compile-custom</goal>
                           </goals>
                       </execution>
                   </executions>
               </plugin>
           </plugins>
       </build>
   
   </project>
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-samples] gakkiyomi closed issue #413: 希望能提供dubbo-grpc-compiler gradle的配置例子

Posted by GitBox <gi...@apache.org>.
gakkiyomi closed issue #413:
URL: https://github.com/apache/dubbo-samples/issues/413


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-samples] jannal edited a comment on issue #413: 希望能提供dubbo-grpc-compiler gradle的配置例子

Posted by GitBox <gi...@apache.org>.
jannal edited a comment on issue #413:
URL: https://github.com/apache/dubbo-samples/issues/413#issuecomment-1018152653


   
   protobuf-gradle-plugin插件目前不能使用Dubbo的这种mainclass,我的解决方式是在build.gradle同即目录下新建一个protobuf-pom.xml,然后mvn clean compile -f protobuf-pom.xml 来生成
   ```
   <?xml version="1.0" encoding="UTF-8"?>
   <project xmlns="http://maven.apache.org/POM/4.0.0"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
       <groupId>cn.jannal.dubbo3</groupId>
       <version>1.0.0-SNAPSHOT</version>
       <modelVersion>4.0.0</modelVersion>
       <artifactId>dubbo-demo-protobuf</artifactId>
       <packaging>jar</packaging>
   
       <dependencyManagement>
           <dependencies>
               <dependency>
                   <groupId>org.apache.dubbo</groupId>
                   <artifactId>dubbo-bom</artifactId>
                   <version>3.0.5</version>
                   <type>pom</type>
                   <scope>import</scope>
               </dependency>
           </dependencies>
       </dependencyManagement>
   
   
       <dependencies>
   
           <dependency>
               <groupId>org.apache.dubbo</groupId>
               <artifactId>dubbo</artifactId>
           </dependency>
           <dependency>
               <groupId>io.grpc</groupId>
               <artifactId>grpc-protobuf</artifactId>
           </dependency>
   
           <dependency>
               <groupId>io.grpc</groupId>
               <artifactId>grpc-stub</artifactId>
           </dependency>
           <dependency>
               <groupId>com.google.protobuf</groupId>
               <artifactId>protobuf-java-util</artifactId>
           </dependency>
       </dependencies>
   
   
   
       <build>
           <extensions>
               <extension>
                   <groupId>kr.motd.maven</groupId>
                   <artifactId>os-maven-plugin</artifactId>
                   <version>1.7.0</version>
               </extension>
           </extensions>
           <plugins>
               <!--maven只负责生成protobuf代码,所以不能设置编译src/main/java-->
               <plugin>
                   <artifactId>maven-compiler-plugin</artifactId>
                   <version>3.3</version>
                   <configuration>
                       <source>1.8</source>
                       <target>1.8</target>
                       <!-- 不编译和复制类 -->
                       <excludes>
                           <exclude>**/*.java</exclude>
                       </excludes>
                   </configuration>
               </plugin>
               <!-- grpc代码生成插件 , protoc-gen-dubbo-java 支持 gRPC 和 Dubbo 两种协议-->
               <plugin>
                   <groupId>org.xolstice.maven.plugins</groupId>
                   <artifactId>protobuf-maven-plugin</artifactId>
                   <version>0.6.1</version>
                   <configuration>
                       <!--v3.19.1 有bug,isStringEmpty未公开-->
                       <protocArtifact>com.google.protobuf:protoc:3.17.3:exe:${os.detected.classifier}</protocArtifact>
                       <pluginId>grpc-java</pluginId>
                       <pluginArtifact>io.grpc:protoc-gen-grpc-java:1.31.1:exe:${os.detected.classifier}</pluginArtifact>
                       <outputDirectory>src/main/dubbo</outputDirectory>
                       <!--默认是grpc-->
                       <pluginParameter>grpc</pluginParameter>
                       <clearOutputDirectory>false</clearOutputDirectory>
                       <protocPlugins>
                           <protocPlugin>
                               <id>dubbo-grpc</id>
                               <groupId>org.apache.dubbo</groupId>
                               <artifactId>dubbo-compiler</artifactId>
                               <!--0.0.2和0.0.3都会报错Could not find resource DubboGrpcInterfaceStub.mustache-->
                               <version>0.0.1</version>
                               <mainClass>org.apache.dubbo.gen.grpc.DubboGrpcGenerator</mainClass>
                           </protocPlugin>
                       </protocPlugins>
                   </configuration>
                   <executions>
                       <execution>
                           <goals>
                               <goal>compile</goal>
                               <goal>compile-custom</goal>
                               <goal>test-compile</goal>
                               <goal>test-compile-custom</goal>
                           </goals>
                       </execution>
                   </executions>
               </plugin>
           </plugins>
       </build>
   
   </project>
   ```
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-samples] gakkiyomi commented on issue #413: 希望能提供dubbo-grpc-compiler gradle的配置例子

Posted by GitBox <gi...@apache.org>.
gakkiyomi commented on issue #413:
URL: https://github.com/apache/dubbo-samples/issues/413#issuecomment-1019042869


   > 
   
   谢谢


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org