通过包含avro自动生成的类来构建war文件

v8wbuo2f  于 2021-07-24  发布在  Java
关注(0)|答案(1)|浏览(384)

我最近开始在我的springboot项目中使用avro和kafka。现在我在谷歌上搜索了一下,似乎找不到一个直接的答案。
当我通过gradle构建文件构建war时,是否可以包含从avro模式自动生成的类?
看看war文件,当它爆炸时,它似乎不包括那些类。
这是我的build.gradle文件。
非常感谢您阅读这个问题,如果您有时间帮助!

  1. plugins {
  2. id "org.springframework.boot" version "2.4.2"
  3. id 'io.spring.dependency-management' version '1.0.8.RELEASE'
  4. id 'java'
  5. id "com.commercehub.gradle.plugin.avro" version "0.21.0"
  6. id "idea"
  7. }
  8. group 'com.test.tge-auth-service'
  9. version '1.0'
  10. java {
  11. sourceCompatibility = JavaVersion.VERSION_14
  12. targetCompatibility = JavaVersion.VERSION_14
  13. }
  14. ext {
  15. avroVersion = "1.10.1"
  16. }
  17. repositories {
  18. mavenCentral()
  19. jcenter()
  20. maven {
  21. url "https://packages.confluent.io/maven/"
  22. }
  23. }
  24. avro {
  25. createSetters = true
  26. fieldVisibility = "PRIVATE"
  27. }
  28. //apply plugin: "war"
  29. dependencies {
  30. // providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
  31. compile group: 'co.elastic.logging', name: 'logback-ecs-encoder', version: '0.5.2'
  32. compile group: 'com.amazonaws', name: 'aws-java-sdk', version: '1.11.860'
  33. compile group: 'io.springfox', name: 'springfox-swagger-ui', version: '3.0.0'
  34. compile group: 'io.springfox', name: 'springfox-boot-starter', version: '3.0.0'
  35. compile('org.springframework.boot:spring-boot-starter-data-elasticsearch')
  36. compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-mongodb', version: '2.3.3.RELEASE'
  37. compile group: 'org.springframework.data', name: 'spring-data-elasticsearch', version: '4.0.4.RELEASE'
  38. compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: '2.3.3.RELEASE'
  39. compile group: 'org.springframework.boot', name: 'spring-boot-starter-security', version: '2.3.3.RELEASE'
  40. compile group: 'org.springframework.security', name: 'spring-security-oauth2-client', version: '5.4.0'
  41. compile group: 'org.springframework.boot', name: 'spring-boot-starter-validation', version: '2.4.2'
  42. compile group: 'org.springframework.kafka', name: 'spring-kafka', version: '2.6.5'
  43. compile group: 'javax.validation', name: 'validation-api', version: '2.0.1.Final'
  44. compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.11.2'
  45. compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.21'
  46. compile group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.1'
  47. compile group: 'org.openapitools', name: 'jackson-databind-nullable', version: '0.2.1'
  48. compile group: 'commons-io', name: 'commons-io', version: '2.6'
  49. compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.4'
  50. compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.11'
  51. compile group: 'org.passay', name: 'passay', version: '1.6.0'
  52. compile group: 'com.google.guava', name: 'guava', version: '30.0-jre'
  53. compile group: 'io.confluent', name: 'kafka-schema-registry-client', version: '6.0.0'
  54. compile group: 'io.confluent', name: 'kafka-avro-serializer', version: '6.0.0'
  55. compile group: 'io.confluent', name: 'monitoring-interceptors', version: '6.0.0'
  56. compile(group: 'io.confluent', name: 'kafka-streams-avro-serde', version:'6.0.0') {
  57. exclude(module: 'log4j-over-slf4j')
  58. }
  59. compile "org.apache.avro:avro:1.10.1"
  60. implementation "org.apache.avro:avro:${avroVersion}"
  61. compileOnly 'org.projectlombok:lombok:1.18.12'
  62. annotationProcessor 'org.projectlombok:lombok:1.18.12'
  63. implementation 'com.amazonaws:aws-java-sdk-s3'
  64. implementation 'org.springframework.boot:spring-boot-starter-web'
  65. testCompile group: 'junit', name: 'junit', version: '4.12'
  66. testCompileOnly 'org.projectlombok:lombok:1.18.12'
  67. testAnnotationProcessor 'org.projectlombok:lombok:1.18.12'
  68. testImplementation('org.springframework.boot:spring-boot-starter-test') {
  69. exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
  70. }
  71. jar {
  72. manifest {
  73. attributes(
  74. 'Main-Class': 'com.test.SpringBootPersistenceApplication'
  75. )
  76. }
  77. from {
  78. configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
  79. }
  80. }
  81. }
c9x0cxw0

c9x0cxw01#

好吧,对我来说,成功的是在intellij中重建项目。

相关问题