build.gradle.kts 905 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. apply(plugin = "java-library")
  23. }
  24. //指定使用的jdk版本
  25. java {
  26. sourceCompatibility = JavaVersion.VERSION_17
  27. targetCompatibility = JavaVersion.VERSION_17
  28. }
  29. dependencies {
  30. testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.0")
  31. testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
  32. }
  33. tasks.getByName<Test>("test") {
  34. useJUnitPlatform()
  35. }