build.gradle 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. plugins {
  2. id "com.google.protobuf" version "0.8.19"
  3. id 'java-library'
  4. }
  5. group 'com.incubator.message'
  6. version '1.0-SNAPSHOT'
  7. dependencies {
  8. testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0'
  9. testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
  10. // implementation 'org.projectlombok:lombok:1.18.36'
  11. api 'com.alibaba.fastjson2:fastjson2:2.0.53'
  12. api 'com.google.protobuf:protobuf-java:4.28.3'
  13. api 'io.grpc:grpc-all:1.68.1'
  14. }
  15. build.dependsOn(copyAllDependencies)
  16. sourceSets {
  17. main {
  18. java {
  19. srcDirs 'build/generated/source/proto/main/grpc'
  20. srcDirs 'build/generated/source/proto/main/java'
  21. }
  22. }
  23. }
  24. protobuf {
  25. //protobuf编译器
  26. protoc {
  27. artifact = 'com.google.protobuf:protoc:4.28.3' // 使用合适的 protoc 版本
  28. }
  29. plugins {
  30. grpc {
  31. artifact = 'io.grpc:protoc-gen-grpc-java:1.68.1'
  32. }
  33. }
  34. generateProtoTasks {
  35. all()*.plugins {
  36. grpc {}
  37. }
  38. }
  39. }