From 142eddfa28cb3951f550f24cb4e712212bf4472a Mon Sep 17 00:00:00 2001 From: LamGC Date: Thu, 14 Apr 2022 22:38:51 +0800 Subject: [PATCH] =?UTF-8?q?refactor(extension):=20Maven=20=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E4=BB=93=E5=BA=93=E8=B7=AF=E5=BE=84=E5=B0=86=E4=BC=9A?= =?UTF-8?q?=E7=9B=B8=E5=AF=B9=E4=BA=8E=20DATA=5FROOT=20=E8=B7=AF=E5=BE=84.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 为防止混淆配置意义, 方便数据转移, 将 Maven 本地仓库路径调整为相对 DATA_ROOT 目录, 绝对路径不受影响. --- scalabot-app/src/main/kotlin/AppConfigs.kt | 1 + scalabot-app/src/main/kotlin/AppMain.kt | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/scalabot-app/src/main/kotlin/AppConfigs.kt b/scalabot-app/src/main/kotlin/AppConfigs.kt index 7360dfa..63a8363 100644 --- a/scalabot-app/src/main/kotlin/AppConfigs.kt +++ b/scalabot-app/src/main/kotlin/AppConfigs.kt @@ -134,6 +134,7 @@ internal data class MavenRepositoryConfig( * @property proxy Telegram API 代理配置. * @property metrics 运行指标数据配置. 可通过时序数据库记录运行数据. * @property mavenRepositories Maven 远端仓库配置. + * @property mavenLocalRepository Maven 本地仓库路径. 相对于运行目录 (而不是 DATA_ROOT 目录) */ internal data class AppConfig( val proxy: ProxyConfig = ProxyConfig(), diff --git a/scalabot-app/src/main/kotlin/AppMain.kt b/scalabot-app/src/main/kotlin/AppMain.kt index 8033e42..b8f2ff1 100644 --- a/scalabot-app/src/main/kotlin/AppMain.kt +++ b/scalabot-app/src/main/kotlin/AppMain.kt @@ -56,7 +56,11 @@ internal class Launcher : AutoCloseable { private val botSessionMap = mutableMapOf() private val mavenLocalRepository = if (Const.config.mavenLocalRepository != null && Const.config.mavenLocalRepository.isNotEmpty()) { - LocalRepository(Const.config.mavenLocalRepository) + val repoPath = AppPaths.DATA_ROOT.file.toPath() + .resolve(Const.config.mavenLocalRepository) + .toRealPath() + .toFile() + LocalRepository(repoPath) } else { LocalRepository("${System.getProperty("user.home")}/.m2/repository") }