dubbo官網(wǎng)的如下實例編譯問題整理
https://cn.dubbo.apache.org/zh/docs3-v2/java-sdk/quick-start/idl/
報dubbo-compiler缺失,使用手動安裝如下jar到mvn倉庫
mvn install:install-file -DgroupId=org.apache.dubbo -DartifactId=dubbo-compiler -Dversion=3.1.5-SNAPSHOT -Dpackaging=jar -Dfile=/Users/baiyan3/Downloads/dubbo-3.1/dubbo-compiler/target/dubbo-compiler-3.1.5-SNAPSHOT.jar
下載dubbo
https://github.com/apache/dubbo
執(zhí)行打包命令
mvn package -Dmaven.test.skip=true
將自動把dubbo每個組件的jar包安裝到mvn的repository目錄下
按照
https://cn.dubbo.apache.org/zh/docs3-v2/java-sdk/quick-start/idl/
這個說明的pom文件編譯會出錯
當然使用protobuf 需要安裝protoc命令
Invalid multicast address /127.0.0.1, ipv4 multicast address scope: 224.0.0.0 - 239.255.255.255
修改如下代碼
src/main/java/org/apache/dubbo/MyDubboServer.java
src/main/java/org/apache/dubbo/MyDubboClient.java
new RegistryConfig("zookeeper://127.0.0.1:2181")
同時需要啟用zookeeper服務,借用下kafka帶的zookeeper服務
bin/zookeeper-server-start.sh config/zookeeper.properties
如果maven plugin 編譯proto文件報錯,手動編譯測試看下報錯信息
protoc -I=/tri-stub-demo/src/main/proto --java_out=/java/tri-stub-demo/target/tmp/ /java/tri-stub-demo/src/main/proto/hello.proto
官網(wǎng)實例中調(diào)整完的pom.xml內(nèi)容如下
4.0.0 org.apache.dubbo tri-stub-demo1.0-SNAPSHOT tri-stub-demo http://www.example.com UTF-8 1.8 1.8 junit junit 4.13 test org.apache.dubbo dubbo 3.0.8 org.apache.dubbo dubbo-rpc-triple 3.1.1 org.apache.dubbo dubbo-dependencies-zookeeper-curator5 pom 3.0.8 com.google.protobuf protobuf-java 3.21.10 kr.motd.maven os-maven-plugin 1.6.1 maven-clean-plugin 3.1.0 maven-resources-plugin 3.0.2 maven-compiler-plugin 3.8.0 maven-surefire-plugin 2.22.1 maven-jar-plugin 3.0.2 maven-install-plugin 2.5.2 maven-deploy-plugin 2.8.2 maven-site-plugin 3.7.1 maven-project-info-reports-plugin 3.0.0 org.codehaus.mojo build-helper-maven-plugin generate-sources add-source org.xolstice.maven.plugins protobuf-maven-plugin 0.6.1 /Users/baiyan3/java/protoc-21.9-osx-aarch_64/bin/protoc com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier} ${project.basedir}/src/main/proto dubbo org.apache.dubbo dubbo-compiler 3.1.1 org.apache.dubbo.gen.tri.Dubbo3TripleGenerator compile
你是否還在尋找穩(wěn)定的海外服務器提供商?創(chuàng)新互聯(lián)www.cdcxhl.cn海外機房具備T級流量清洗系統(tǒng)配攻擊溯源,準確流量調(diào)度確保服務器高可用性,企業(yè)級服務器適合批量采購,新人活動首月15元起,快前往官網(wǎng)查看詳情吧