johnclot69 1 сар өмнө
parent
commit
2ff04a0ec3

+ 51 - 0
build.gradle

@@ -0,0 +1,51 @@
+subprojects {
+    apply plugin: 'java';
+    apply plugin: 'idea';
+
+    // 配置Java版本
+    java {
+        toolchain {
+            languageVersion.set(JavaLanguageVersion.of(23))  // 设置 JDK 23
+        }
+    }
+
+    // 配置编译选项
+    tasks.withType(JavaCompile).configureEach {
+        options.encoding = 'UTF-8'
+        options.incremental = true // 启用增量编译
+
+        // 启用现代编译参数
+        options.compilerArgs.addAll([
+                '--enable-preview',          // 启用预览特性
+                '-parameters'                // 保留方法参数名
+        ])
+    }
+
+    // 现代任务注册方式
+    tasks.register('copyAllDependencies', Copy) {
+        group = 'Build'
+        description = 'Copies all dependencies to lib directory'
+
+        from configurations.runtimeClasspath
+        into layout.buildDirectory.dir("libs/lib")  // 使用现代路径 API
+
+        // 添加分类器过滤(可选)
+        include '*.jar'
+        exclude '*-sources.jar', '*-javadoc.jar'
+    }
+
+    // 构建后自动复制依赖(按需启用)
+    tasks.named('build') {
+        finalizedBy tasks.named('copyAllDependencies')
+    }
+
+    // 测试配置现代化
+    tasks.named('test', Test) {
+        useJUnitPlatform()
+        maxHeapSize = '2G'
+
+        // 并行测试配置
+        maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
+        forkEvery = 100
+    }
+}

+ 7 - 0
gradle/wrapper/gradle-wrapper.properties

@@ -0,0 +1,7 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists

+ 234 - 0
gradlew

@@ -0,0 +1,234 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+#
+#   Gradle start up script for POSIX generated by Gradle.
+#
+#   Important for running:
+#
+#   (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+#       noncompliant, but you have some other compliant shell such as ksh or
+#       bash, then to run this script, type that shell name before the whole
+#       command line, like:
+#
+#           ksh Gradle
+#
+#       Busybox and similar reduced shells will NOT work, because this script
+#       requires all of these POSIX shell features:
+#         * functions;
+#         * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+#           «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+#         * compound commands having a testable exit status, especially «case»;
+#         * various built-in commands including «command», «set», and «ulimit».
+#
+#   Important for patching:
+#
+#   (2) This script targets any POSIX shell, so it avoids extensions provided
+#       by Bash, Ksh, etc; in particular arrays are avoided.
+#
+#       The "traditional" practice of packing multiple parameters into a
+#       space-separated string is a well documented source of bugs and security
+#       problems, so this is (mostly) avoided, by progressively accumulating
+#       options in "$@", and eventually passing that to Java.
+#
+#       Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+#       and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+#       see the in-line comments for details.
+#
+#       There are tweaks for specific operating systems such as AIX, CygWin,
+#       Darwin, MinGW, and NonStop.
+#
+#   (3) This script is generated from the Groovy template
+#       https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+#       within the Gradle project.
+#
+#       You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+    APP_HOME=${app_path%"${app_path##*/}"}  # leaves a trailing /; empty if no leading path
+    [ -h "$app_path" ]
+do
+    ls=$( ls -ld "$app_path" )
+    link=${ls#*' -> '}
+    case $link in             #(
+      /*)   app_path=$link ;; #(
+      *)    app_path=$APP_HOME$link ;;
+    esac
+done
+
+APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
+
+APP_NAME="Gradle"
+APP_BASE_NAME=${0##*/}
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+    echo "$*"
+} >&2
+
+die () {
+    echo
+    echo "$*"
+    echo
+    exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in                #(
+  CYGWIN* )         cygwin=true  ;; #(
+  Darwin* )         darwin=true  ;; #(
+  MSYS* | MINGW* )  msys=true    ;; #(
+  NONSTOP* )        nonstop=true ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+        # IBM's JDK on AIX uses strange locations for the executables
+        JAVACMD=$JAVA_HOME/jre/sh/java
+    else
+        JAVACMD=$JAVA_HOME/bin/java
+    fi
+    if [ ! -x "$JAVACMD" ] ; then
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+    fi
+else
+    JAVACMD=java
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+    case $MAX_FD in #(
+      max*)
+        MAX_FD=$( ulimit -H -n ) ||
+            warn "Could not query maximum file descriptor limit"
+    esac
+    case $MAX_FD in  #(
+      '' | soft) :;; #(
+      *)
+        ulimit -n "$MAX_FD" ||
+            warn "Could not set maximum file descriptor limit to $MAX_FD"
+    esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+#   * args from the command line
+#   * the main class name
+#   * -classpath
+#   * -D...appname settings
+#   * --module-path (only if needed)
+#   * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+    APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+    CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+    JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
+    for arg do
+        if
+            case $arg in                                #(
+              -*)   false ;;                            # don't mess with options #(
+              /?*)  t=${arg#/} t=/${t%%/*}              # looks like a POSIX filepath
+                    [ -e "$t" ] ;;                      #(
+              *)    false ;;
+            esac
+        then
+            arg=$( cygpath --path --ignore --mixed "$arg" )
+        fi
+        # Roll the args list around exactly as many times as the number of
+        # args, so each arg winds up back in the position where it started, but
+        # possibly modified.
+        #
+        # NB: a `for` loop captures its iteration list before it begins, so
+        # changing the positional parameters here affects neither the number of
+        # iterations, nor the values presented in `arg`.
+        shift                   # remove old arg
+        set -- "$@" "$arg"      # push replacement arg
+    done
+fi
+
+# Collect all arguments for the java command;
+#   * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
+#     shell script including quotes and variable substitutions, so put them in
+#     double quotes to make sure that they get re-expanded; and
+#   * put everything else in single quotes, so that it's not re-expanded.
+
+set -- \
+        "-Dorg.gradle.appname=$APP_BASE_NAME" \
+        -classpath "$CLASSPATH" \
+        org.gradle.wrapper.GradleWrapperMain \
+        "$@"
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+#   readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+#   set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+        printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+        xargs -n1 |
+        sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+        tr '\n' ' '
+    )" '"$@"'
+
+exec "$JAVACMD" "$@"

+ 89 - 0
gradlew.bat

@@ -0,0 +1,89 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem      https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem  Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega

+ 116 - 0
incubator-app/build.gradle

@@ -0,0 +1,116 @@
+plugins {
+    id 'java'
+    id 'application'
+    id 'com.github.johnrengelman.shadow' version "8.1.1"
+}
+
+group = 'com.incubator.app'
+version = '1.0-SNAPSHOT'
+
+// 使用 Gradle 的现代 API 定义源集
+sourceSets {
+    main {
+        resources {
+            srcDirs = ['conf'] // 移除 += 以明确覆盖默认值
+        }
+    }
+}
+
+application {
+    // 类型安全的主类配置
+    mainClass = "App"
+
+    // 配置 JVM 参数,支持高并发和性能优化
+    applicationDefaultJvmArgs = [
+            "-XX:+UseZGC",                   // 使用 ZGC 垃圾回收器,适合高并发
+            "-Xmx2G",                       // 限制最大堆大小
+            "-XX:+UnlockExperimentalVMOptions", // 启用实验性选项
+            "-XX:ZUncommitDelay=300",       // 减少内存未使用时的延迟
+            "-XX:+HeapDumpOnOutOfMemoryError", // OOM 时生成堆转储
+            "-XX:ZCollectionInterval=3",
+            "-Dio.netty.allocator.numDirectArenas=0", // 禁用堆外内存
+            "-Dio.netty.leakDetection.level=PARANOID"
+    ]
+}
+
+tasks.withType(JavaCompile).configureEach {
+    options.compilerArgs += "--enable-preview"
+}
+
+// 禁用默认的 JAR 任务,因为我们使用 Shadow JAR
+tasks.named('jar') {
+    enabled = false
+}
+
+// 配置 Shadow JAR 任务
+tasks.shadowJar {
+    zip64 = true
+    // 设置 JAR 包的基本名称
+    archiveBaseName = 'incubator-app'
+    // 使用项目的版本号作为 JAR 的版本
+    archiveVersion = project.version
+    // 移除分类器,生成的 JAR 没有后缀
+    archiveClassifier = ''
+
+    // 添加自定义清单
+    manifest {
+        // 使用动态设置的主类
+        attributes(
+                'Main-Class': application.mainClass.get()
+        )
+    }
+
+    // 将 conf 目录包含到最终的 JAR 文件中
+    from('conf') { into('conf') }
+
+    // 可选:排除不必要的依赖
+    exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA'
+
+    // 避免重复打包无关的文件
+    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 {
+    useJUnitPlatform()
+    testLogging {
+        events 'PASSED', 'FAILED', 'SKIPPED'
+    }
+    maxParallelForks = Runtime.runtime.availableProcessors() // 并行测试
+}
+
+// 将 Shadow JAR 绑定到 assemble 阶段
+tasks.named('assemble') {
+    dependsOn tasks.named = 'shadowJar' as Task
+}
+
+// 增加构建信息任务
+tasks.register("buildInfo") {
+    doLast {
+        def mainClass = application.mainClass.get()
+        def shadowJarPath = tasks.shadowJar.flatMap { it.archiveFile }.get().asFile.absolutePath
+
+        println """
+        |Project: ${project.name}
+        |Version: ${project.version}
+        |Main Class: $mainClass
+        |Shadow JAR Path: $shadowJarPath
+        """.stripMargin()
+    }
+}
+
+// 清理任务优化
+tasks.named('clean') {
+    delete(layout.buildDirectory)
+}

+ 0 - 148
incubator-app/pom.xml

@@ -1,148 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
-                             http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <parent>
-    <groupId>com.incubator</groupId>
-    <artifactId>IncubatorGame</artifactId>
-    <version>1.0-SNAPSHOT</version>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-
-  <groupId>com.incubator.app</groupId>
-  <artifactId>incubator-app</artifactId>
-  <version>1.0-SNAPSHOT</version>
-  <name>incubator-app</name>
-
-  <!-- 将 conf 目录包含为资源 -->
-  <build>
-    <resources>
-      <resource>
-        <directory>conf</directory>
-        <targetPath>conf</targetPath>
-        <filtering>false</filtering>
-      </resource>
-    </resources>
-    <plugins>
-      <!-- Java 编译插件 -->
-      <plugin>
-        <artifactId>maven-compiler-plugin</artifactId>
-      </plugin>
-      <!-- Maven Jar 插件:设置主清单 Main-Class -->
-      <plugin>
-        <artifactId>maven-jar-plugin</artifactId>
-        <version>3.3.0</version>
-        <configuration>
-          <archive>
-            <manifestEntries>
-              <!-- 主类 -->
-              <Main-Class>App</Main-Class>
-            </manifestEntries>
-          </archive>
-        </configuration>
-      </plugin>
-      <!-- Shade 插件:生成包含所有依赖的可执行 JAR -->
-      <plugin>
-        <artifactId>maven-shade-plugin</artifactId>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <!-- 禁止生成dependency-reduced-pom.xml -->
-              <createDependencyReducedPom>false</createDependencyReducedPom>
-              <!-- 不附加 classifier,使生成的 JAR 名称为 incubator-app-${version}.jar -->
-              <shadedArtifactAttached>false</shadedArtifactAttached>
-              <transformers>
-                <!-- 将 Main-Class 添加到清单 -->
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
-                  <mainClass>App</mainClass>
-                </transformer>
-              </transformers>
-              <filters>
-                <filter>
-                  <artifact>*:*</artifact>
-                  <excludes>
-                    <!-- 排除签名文件 -->
-                    <exclude>META-INF/*.SF</exclude>
-                    <exclude>META-INF/*.DSA</exclude>
-                    <exclude>META-INF/*.RSA</exclude>
-                    <exclude>META-INF/*</exclude>
-                    <exclude>META-INF/maven/**</exclude>
-                    <exclude>META-INF/versions/**</exclude>
-                    <exclude>module-info.class</exclude>
-                  </excludes>
-                </filter>
-              </filters>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <!-- Exec 插件:运行时 JVM 参数(可选配置) -->
-      <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>exec-maven-plugin</artifactId>
-        <version>3.1.0</version>
-        <executions>
-          <execution>
-            <id>run-with-args</id>
-            <goals><goal>java</goal></goals>
-            <configuration>
-              <mainClass>App</mainClass>
-              <arguments>
-                <!-- 模拟 applicationDefaultJvmArgs -->
-                <argument>-XX:+UseZGC</argument>
-                <argument>-Xmx2G</argument>
-                <argument>-XX:+UnlockExperimentalVMOptions</argument>
-                <argument>-XX:ZUncommitDelay=300</argument>
-                <argument>-XX:+HeapDumpOnOutOfMemoryError</argument>
-                <argument>-XX:ZCollectionInterval=3</argument>
-                <argument>-Dio.netty.allocator.numDirectArenas=0</argument>
-                <argument>-Dio.netty.leakDetection.level=PARANOID</argument>
-              </arguments>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <!-- 复制依赖到目标目录 -->
-      <plugin>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>copy-dependencies</id>
-            <phase>package</phase>
-            <goals><goal>copy-dependencies</goal></goals>
-            <configuration>
-              <outputDirectory>${project.build.directory}/libs/lib</outputDirectory>
-              <includeScope>runtime</includeScope>
-              <excludeClassifiers>*-sources,*-javadoc</excludeClassifiers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-
-  <dependencies>
-    <!-- 依赖 incubator-game 模块 -->
-    <dependency>
-      <groupId>com.incubator.game</groupId>
-      <artifactId>incubator-game</artifactId>
-      <version>1.0-SNAPSHOT</version>
-    </dependency>
-
-    <!-- 测试依赖(JUnit 5) -->
-    <dependency>
-      <groupId>org.junit.jupiter</groupId>
-      <artifactId>junit-jupiter-api</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.junit.jupiter</groupId>
-      <artifactId>junit-jupiter-engine</artifactId>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-</project>

+ 28 - 0
incubator-core/build.gradle

@@ -0,0 +1,28 @@
+plugins {
+    id "java-library"
+}
+
+group = "com.incubator.core"
+version = "1.0-SNAPSHOT"
+
+dependencies {
+    // 系统核心依赖
+    api 'net.onedaybeard.artemis:artemis-odb:2.3.0'
+    api 'it.unimi.dsi:fastutil:8.5.15'
+
+    // 网络通信和序列化
+    api 'io.netty:netty-all:4.2.1.Final' // Netty 全功能包
+    api 'org.msgpack:msgpack-core:0.9.9' // MessagePack 序列化
+    api 'org.msgpack:jackson-dataformat-msgpack:0.9.9' // MessagePack 序列化
+
+    // 测试依赖
+    testImplementation platform("org.junit:junit-bom:5.10.0")
+    testImplementation "org.junit.jupiter:junit-jupiter-api"
+    testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
+}
+
+configurations.configureEach {
+    exclude group: 'ch.qos.logback', module: 'logback-classic'
+}
+
+build.dependsOn(copyAllDependencies)

+ 0 - 98
incubator-core/pom.xml

@@ -1,98 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
-                             http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <parent>
-    <groupId>com.incubator</groupId>
-    <artifactId>IncubatorGame</artifactId>
-    <version>1.0-SNAPSHOT</version>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-
-  <groupId>com.incubator.core</groupId>
-  <artifactId>incubator-core</artifactId>
-  <version>1.0-SNAPSHOT</version>
-  <name>incubator-core</name>
-
-  <dependencies>
-    <!-- 系统核心依赖 -->
-    <dependency>
-      <groupId>net.onedaybeard.artemis</groupId>
-      <artifactId>artemis-odb</artifactId>
-      <version>2.3.0</version>
-      <!-- 排除 logback-classic 依赖 -->
-      <exclusions>
-        <exclusion>
-          <groupId>ch.qos.logback</groupId>
-          <artifactId>logback-classic</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>it.unimi.dsi</groupId>
-      <artifactId>fastutil</artifactId>
-      <version>8.5.15</version>
-    </dependency>
-
-    <!-- 网络通信和序列化依赖 -->
-    <dependency>
-      <groupId>io.netty</groupId>
-      <artifactId>netty-all</artifactId>
-      <version>4.2.0.Final</version>
-    </dependency>
-    <dependency>
-      <groupId>org.msgpack</groupId>
-      <artifactId>msgpack-core</artifactId>
-      <version>0.9.9</version>
-    </dependency>
-    <dependency>
-      <groupId>org.msgpack</groupId>
-      <artifactId>jackson-dataformat-msgpack</artifactId>
-      <version>0.9.9</version>
-    </dependency>
-
-    <!-- 测试依赖(JUnit 5) -->
-    <dependency>
-      <groupId>org.junit.jupiter</groupId>
-      <artifactId>junit-jupiter-api</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.junit.jupiter</groupId>
-      <artifactId>junit-jupiter-engine</artifactId>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <!-- 继承父级插件管理配置 -->
-    <plugins>
-      <!-- Java 编译插件 -->
-      <plugin>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <configuration>
-          <!-- 继承父级 java.version、编译参数等 -->
-        </configuration>
-      </plugin>
-      <!-- 复制依赖到目标目录(模拟 Gradle 的 copyAllDependencies 任务) -->
-      <plugin>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>copy-dependencies</id>
-            <phase>package</phase>
-            <goals>
-              <goal>copy-dependencies</goal>
-            </goals>
-            <configuration>
-              <outputDirectory>${project.build.directory}/libs/lib</outputDirectory>
-              <includeScope>runtime</includeScope>
-              <excludeTransitive>false</excludeTransitive>
-              <excludeClassifiers>*-sources,*-javadoc</excludeClassifiers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-</project>

+ 19 - 0
incubator-game/build.gradle

@@ -0,0 +1,19 @@
+plugins {
+    id 'java-library'
+}
+
+group = 'com.incubator.game'
+version = '1.0-SNAPSHOT'
+
+dependencies {
+    testImplementation(platform('org.junit:junit-bom:5.10.0'))
+    testImplementation('org.junit.jupiter:junit-jupiter')
+
+    api project(path: ':incubator-core')
+}
+
+configurations.configureEach {
+    exclude group: 'ch.qos.logback', module: 'logback-classic'
+}
+
+build.dependsOn(copyAllDependencies)

+ 0 - 57
incubator-game/pom.xml

@@ -1,57 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
-                             http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <parent>
-    <groupId>com.incubator</groupId>
-    <artifactId>IncubatorGame</artifactId>
-    <version>1.0-SNAPSHOT</version>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-
-  <groupId>com.incubator.game</groupId>
-  <artifactId>incubator-game</artifactId>
-  <version>1.0-SNAPSHOT</version>
-  <name>incubator-game</name>
-
-  <dependencies>
-    <!-- 依赖 incubator-core 模块 -->
-    <dependency>
-      <groupId>com.incubator.core</groupId>
-      <artifactId>incubator-core</artifactId>
-      <version>1.0-SNAPSHOT</version>
-    </dependency>
-
-    <!-- 测试依赖(JUnit 5) -->
-    <dependency>
-      <groupId>org.junit.jupiter</groupId>
-      <artifactId>junit-jupiter</artifactId>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <!-- Java 编译插件 -->
-      <plugin>
-        <artifactId>maven-compiler-plugin</artifactId>
-      </plugin>
-      <!-- 复制依赖到目标目录 -->
-      <plugin>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>copy-dependencies</id>
-            <phase>package</phase>
-            <goals><goal>copy-dependencies</goal></goals>
-            <configuration>
-              <outputDirectory>${project.build.directory}/libs/lib</outputDirectory>
-              <includeScope>runtime</includeScope>
-              <excludeClassifiers>*-sources,*-javadoc</excludeClassifiers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-</project>

+ 0 - 96
pom.xml

@@ -1,96 +0,0 @@
-<!-- 父级 POM:管理公共属性、插件版本、依赖版本等 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
-                             http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-
-  <!-- 父级项目信息 -->
-  <groupId>com.incubator</groupId>
-  <artifactId>IncubatorGame</artifactId>
-  <version>1.0-SNAPSHOT</version>
-  <packaging>pom</packaging>
-  <name>IncubatorGame</name>
-
-  <!-- 统一使用的 Java 版本 -->
-  <properties>
-    <java.version>23</java.version>
-    <maven.compiler.source>${java.version}</maven.compiler.source>
-    <maven.compiler.target>${java.version}</maven.compiler.target>
-    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-  </properties>
-
-  <!-- 各模块列表 -->
-  <modules>
-    <module>incubator-core</module>
-    <module>incubator-game</module>
-    <module>incubator-app</module>
-  </modules>
-
-  <!-- 依赖管理:统一管理版本(包含 JUnit BOM) -->
-  <dependencyManagement>
-    <dependencies>
-      <!-- JUnit BOM (引入后子模块可省略版本号) -->
-      <dependency>
-        <groupId>org.junit</groupId>
-        <artifactId>junit-bom</artifactId>
-        <version>5.10.0</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-      <!-- 也可在此处管理其他常用依赖版本 -->
-    </dependencies>
-  </dependencyManagement>
-
-  <!-- 插件管理:统一版本和配置 -->
-  <build>
-    <pluginManagement>
-      <plugins>
-        <!-- Java 编译插件:设置源码版本、编译参数等 -->
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-compiler-plugin</artifactId>
-          <version>3.10.1</version>
-          <configuration>
-            <source>${java.version}</source>
-            <target>${java.version}</target>
-            <encoding>${project.build.sourceEncoding}</encoding>
-            <compilerArgs>
-              <!-- 开启预览特性、保留参数名等 -->
-              <arg>--enable-preview</arg>
-              <arg>-parameters</arg>
-            </compilerArgs>
-          </configuration>
-        </plugin>
-        <!-- Surefire 插件:用于运行单元测试(支持 JUnit 5) -->
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-surefire-plugin</artifactId>
-          <version>3.0.0-M7</version>
-          <configuration>
-            <!-- 使用 JUnit 平台(JUnit 5) -->
-            <useModulePath>false</useModulePath>
-          </configuration>
-        </plugin>
-        <!-- Shade 插件:用于打包可执行 JAR(包括依赖) -->
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-shade-plugin</artifactId>
-          <version>3.4.1</version>
-        </plugin>
-        <!-- Exec 插件:可用于运行带参数的 Java 应用 -->
-        <plugin>
-          <groupId>org.codehaus.mojo</groupId>
-          <artifactId>exec-maven-plugin</artifactId>
-          <version>3.1.0</version>
-        </plugin>
-        <!-- Dependency 插件:复制依赖到指定目录(可选,用于模拟 Gradle copyAllDependencies 任务) -->
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-dependency-plugin</artifactId>
-          <version>3.5.0</version>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-  </build>
-</project>

+ 19 - 0
settings.gradle

@@ -0,0 +1,19 @@
+rootProject.name = 'IncubatorGame'
+
+dependencyResolutionManagement {
+    repositories {
+        // 优先使用本地 Maven 缓存
+        mavenLocal()
+        // 阿里云公共仓库
+        maven { url = 'https://maven.aliyun.com/repository/public' }
+        // 阿里云 Gradle 插件仓库
+        maven { url = 'https://maven.aliyun.com/repository/gradle-plugin' }
+        // 官方仓库作为备用
+        mavenCentral()
+    }
+}
+
+include("incubator-core")
+include("incubator-game")
+include("incubator-app")
+