maven编译proto

maven编译protobuf

pom添加如下依赖

 
        1.6.1
        2.6.1
 
 

     
            io.grpc
            grpc-netty
            ${grpc.version}
            provided
        
        
            io.grpc
            grpc-protobuf
            ${grpc.version}
            provided
        
        
            io.grpc
            grpc-stub
            ${grpc.version}
            provided
        
    

 
        
            
                kr.motd.maven
                os-maven-plugin
                1.5.0.Final
            
        
        
            
                org.apache.maven.plugins
                maven-compiler-plugin
                
                    ${java.version}
                    ${java.version}
                
            
            
                org.xolstice.maven.plugins
                protobuf-maven-plugin
                0.5.0
                
                    com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}
                    
                    grpc-java
                    io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}
                    
                
                
                    
                        
                            compile
                            compile-custom
                        
                    
                
            
        
    

如果要自动生成包名请在.proto首行上增加

option java_package = "包名";

你可能感兴趣的:(maven编译proto)