refactor(extension): Maven 本地仓库路径将会相对于 DATA_ROOT 路径.

为防止混淆配置意义, 方便数据转移, 将 Maven 本地仓库路径调整为相对 DATA_ROOT 目录, 绝对路径不受影响.
This commit is contained in:
LamGC 2022-04-14 22:38:51 +08:00
parent 64849adfab
commit 142eddfa28
Signed by: LamGC
GPG Key ID: 6C5AE2A913941E1D
2 changed files with 6 additions and 1 deletions

View File

@ -134,6 +134,7 @@ internal data class MavenRepositoryConfig(
* @property proxy Telegram API 代理配置. * @property proxy Telegram API 代理配置.
* @property metrics 运行指标数据配置. 可通过时序数据库记录运行数据. * @property metrics 运行指标数据配置. 可通过时序数据库记录运行数据.
* @property mavenRepositories Maven 远端仓库配置. * @property mavenRepositories Maven 远端仓库配置.
* @property mavenLocalRepository Maven 本地仓库路径. 相对于运行目录 (而不是 DATA_ROOT 目录)
*/ */
internal data class AppConfig( internal data class AppConfig(
val proxy: ProxyConfig = ProxyConfig(), val proxy: ProxyConfig = ProxyConfig(),

View File

@ -56,7 +56,11 @@ internal class Launcher : AutoCloseable {
private val botSessionMap = mutableMapOf<ScalaBot, BotSession>() private val botSessionMap = mutableMapOf<ScalaBot, BotSession>()
private val mavenLocalRepository = private val mavenLocalRepository =
if (Const.config.mavenLocalRepository != null && Const.config.mavenLocalRepository.isNotEmpty()) { 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 { } else {
LocalRepository("${System.getProperty("user.home")}/.m2/repository") LocalRepository("${System.getProperty("user.home")}/.m2/repository")
} }