build.gradle 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. plugins {
  2. id "checkstyle"
  3. id "io.spring.javaformat" version "0.0.42"
  4. id 'io.spring.nohttp' version '0.0.11'
  5. }
  6. allprojects {
  7. apply plugin: 'checkstyle'
  8. apply plugin: 'io.spring.javaformat'
  9. dependencies {
  10. checkstyle "io.spring.javaformat:spring-javaformat-checkstyle:0.0.42"
  11. }
  12. // Ensure every test task has at least a single test
  13. tasks.withType(Test).configureEach {
  14. afterSuite { desc, result ->
  15. if (result.testCount == 0) {
  16. throw new IllegalStateException("No tests were found. Ensure that useJUnitPlatform was used.")
  17. }
  18. }
  19. }
  20. // Spring Framework 6.1 requires -parameters to be able to introspect method parameter names
  21. tasks.withType(JavaCompile) {
  22. options.compilerArgs.add("-parameters")
  23. }
  24. tasks.matching { it.name == 'checkFormatAot' }.all { task ->
  25. task.enabled = false
  26. }
  27. }
  28. if (hasProperty('buildScan')) {
  29. buildScan {
  30. termsOfServiceUrl = 'https://gradle.com/terms-of-service'
  31. termsOfServiceAgree = 'yes'
  32. }
  33. }
  34. repositories {
  35. mavenCentral()
  36. }
  37. tasks.register('runAllTests') {
  38. var allTasks = rootProject.getAllTasks(true)
  39. var allTestsTasks = allTasks.values().collect { t ->
  40. t.findAll { it.name == 'test' || it.name == 'integrationTest' }
  41. }.flatten()
  42. it.dependsOn {
  43. allTestsTasks
  44. }
  45. }