build.gradle 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. subprojects {
  2. apply plugin: 'java'
  3. apply plugin: 'idea'
  4. // 配置Java版本
  5. java {
  6. toolchain {
  7. languageVersion.set(JavaLanguageVersion.of(23)) // 设置 JDK 23
  8. }
  9. }
  10. repositories {
  11. // 优先使用本地 Maven 缓存
  12. mavenLocal()
  13. // 阿里云公共仓库
  14. maven { url "https://maven.aliyun.com/repository/public" }
  15. // 阿里云 Gradle 插件仓库
  16. maven { url "https://maven.aliyun.com/repository/gradle-plugin" }
  17. // 官方仓库作为备用
  18. mavenCentral()
  19. }
  20. // 配置编译选项
  21. tasks.withType(JavaCompile).configureEach {
  22. options.encoding = 'UTF-8'
  23. options.incremental = true // 启用增量编译
  24. // options.compilerArgs += ['-Xlint:unchecked', '-Xlint:deprecation']
  25. }
  26. // 复制依赖任务,使用更现代的 `runtimeClasspath`
  27. task copyAllDependencies(type: Copy) {
  28. from configurations.runtimeClasspath
  29. into "${buildDir}/libs/lib"
  30. }
  31. }