You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Scala 2.13中scala-logging的Logger无法解析问题求助

解决Scala 2.13中scala-logging的Logger无法解析问题
  • 核心问题:依赖artifactId不匹配
    你当前配置的scala-logging_3是适配Scala 3的版本,而你的项目基于Scala 2.13,必须使用对应Scala 2.13的artifactId格式。

    替换为正确的pom.xml依赖:

    <dependency>
        <groupId>com.typesafe.scala-logging</groupId>
        <artifactId>scala-logging_2.13</artifactId>
        <version>3.9.5</version>
    </dependency>
    
  • 同步依赖并验证

    • 执行mvn clean compile命令,强制刷新依赖并编译项目,确保新依赖被正确下载
    • 若使用IDE开发,比如IntelliJ,右键项目选择Maven -> Reload Project,清除IDE缓存
  • 代码确认
    你的代码导入和Logger实例化逻辑是正确的,依赖修复后即可正常解析:

    import com.typesafe.scalalogging.Logger
    val logger: Logger = com.typesafe.scalalogging.Logger(this.getClass)
    

内容的提问来源于stack exchange,提问作者Gary

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.12 09:55:26