build.gradle.kts 833 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. plugins {
  2. java
  3. }
  4. group = "space.anyi"
  5. version = "1.0-SNAPSHOT"
  6. description = "学习springboot自动配置的项目,顺便学习gradle进行项目构建"
  7. //在所有子项目中指定编码
  8. allprojects {
  9. repositories {
  10. mavenCentral()
  11. }
  12. tasks.withType<JavaCompile> {
  13. options.encoding = "UTF-8"
  14. }
  15. tasks.withType<Javadoc> {
  16. options.encoding = "UTF-8"
  17. }
  18. tasks.withType<Test> {
  19. systemProperty("file.encoding", "UTF-8")
  20. }
  21. }
  22. //指定使用的jdk版本
  23. java {
  24. sourceCompatibility = JavaVersion.VERSION_17
  25. targetCompatibility = JavaVersion.VERSION_17
  26. }
  27. dependencies {
  28. testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.0")
  29. testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
  30. }
  31. tasks.getByName<Test>("test") {
  32. useJUnitPlatform()
  33. }