Browse Source

优化gradle配置

johnclot69 1 month ago
parent
commit
f12d843f01
5 changed files with 16 additions and 18 deletions
  1. 0 7
      build.gradle
  2. 11 11
      incubator-app/build.gradle
  3. 1 0
      incubator-core/build.gradle
  4. 1 0
      incubator-game/build.gradle
  5. 3 0
      settings.gradle

+ 0 - 7
build.gradle

@@ -2,13 +2,6 @@ subprojects {
     apply plugin: 'java';
     apply plugin: 'java';
     apply plugin: 'idea';
     apply plugin: 'idea';
 
 
-    // 配置Java版本
-    java {
-        toolchain {
-            languageVersion.set(JavaLanguageVersion.of(23))  // 设置 JDK 23
-        }
-    }
-
     // 配置编译选项
     // 配置编译选项
     tasks.withType(JavaCompile).configureEach {
     tasks.withType(JavaCompile).configureEach {
         options.encoding = 'UTF-8'
         options.encoding = 'UTF-8'

+ 11 - 11
incubator-app/build.gradle

@@ -7,6 +7,17 @@ plugins {
 group = 'com.incubator.app'
 group = 'com.incubator.app'
 version = '1.0-SNAPSHOT'
 version = '1.0-SNAPSHOT'
 
 
+// 项目依赖
+dependencies {
+    // 子模块依赖
+    implementation project(':incubator-game')
+
+    // 测试依赖
+    testImplementation platform("org.junit:junit-bom:5.10.0")
+    testImplementation "org.junit.jupiter:junit-jupiter-api"
+    testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
+}
+
 // 使用 Gradle 的现代 API 定义源集
 // 使用 Gradle 的现代 API 定义源集
 sourceSets {
 sourceSets {
     main {
     main {
@@ -70,17 +81,6 @@ tasks.shadowJar {
     duplicatesStrategy = DuplicatesStrategy.EXCLUDE
     duplicatesStrategy = DuplicatesStrategy.EXCLUDE
 }
 }
 
 
-// 项目依赖
-dependencies {
-    // 子模块依赖
-    implementation project(':incubator-game')
-
-    // 测试依赖
-    testImplementation platform("org.junit:junit-bom:5.10.0")
-    testImplementation "org.junit.jupiter:junit-jupiter-api"
-    testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
-}
-
 // 配置测试任务
 // 配置测试任务
 tasks.test {
 tasks.test {
     useJUnitPlatform()
     useJUnitPlatform()

+ 1 - 0
incubator-core/build.gradle

@@ -5,6 +5,7 @@ plugins {
 group = "com.incubator.core"
 group = "com.incubator.core"
 version = "1.0-SNAPSHOT"
 version = "1.0-SNAPSHOT"
 
 
+// 项目依赖
 dependencies {
 dependencies {
     // 系统核心依赖
     // 系统核心依赖
     api 'net.onedaybeard.artemis:artemis-odb:2.3.0'
     api 'net.onedaybeard.artemis:artemis-odb:2.3.0'

+ 1 - 0
incubator-game/build.gradle

@@ -5,6 +5,7 @@ plugins {
 group = 'com.incubator.game'
 group = 'com.incubator.game'
 version = '1.0-SNAPSHOT'
 version = '1.0-SNAPSHOT'
 
 
+// 项目依赖
 dependencies {
 dependencies {
     testImplementation(platform('org.junit:junit-bom:5.10.0'))
     testImplementation(platform('org.junit:junit-bom:5.10.0'))
     testImplementation('org.junit.jupiter:junit-jupiter')
     testImplementation('org.junit.jupiter:junit-jupiter')

+ 3 - 0
settings.gradle

@@ -1,5 +1,8 @@
 rootProject.name = 'IncubatorGame'
 rootProject.name = 'IncubatorGame'
 
 
+// 配置Java版本
+JavaLanguageVersion.of(23)
+
 dependencyResolutionManagement {
 dependencyResolutionManagement {
     repositories {
     repositories {
         // 优先使用本地 Maven 缓存
         // 优先使用本地 Maven 缓存