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

Scala项目build.sbt添加TerminalFX依赖报错:为何未用指定仓库查找pom文件

问题原因与解决办法

核心问题:你配置的TerminalFX仓库地址无效

你指定的https://github.com/javaterminal/TerminalFX/blob/master/releases是GitHub的网页展示路径(blob页面),不是有效的Maven仓库地址。SBT无法从这个网页路径解析并拉取依赖包,所以会自动 fallback 到默认的Maven中央仓库查找,而中央仓库里没有这个包,就会报错。

解决步骤

  1. 修正仓库地址
    改用GitHub仓库的raw内容地址,这个地址能直接访问到仓库里的pom/jar文件:

    resolvers += "terminalfx-repo" at "https://raw.githubusercontent.com/javaterminal/TerminalFX/master/releases"
    
  2. 验证依赖坐标
    确认TerminalFX的依赖坐标和仓库里的文件一致,你当前的坐标"com.kodedu.terminalfx" % "terminalfx" % "1.2.0"是正确的,和仓库里的文件结构匹配。

  3. 修改后的完整build.sbt片段

    // for scalaFX
    libraryDependencies += "org.scalafx" %% "scalafx" % "16.0.0-R24"
    scalacOptions += "-Ymacro-annotations"
    
    // for scalaFXML
    libraryDependencies += "org.scalafx" %% "scalafxml-core-sfx8" % "0.5"
    
    // for terminalFX
    libraryDependencies += "com.kodedu.terminalfx" % "terminalfx" % "1.2.0"
    
    resolvers += "terminalfx-repo" at "https://raw.githubusercontent.com/javaterminal/TerminalFX/master/releases"
    

补充说明

Maven仓库要求地址能直接映射到groupId/artifactId/version/的文件结构,GitHub的blob页面是经过渲染的网页,不符合这个要求;而raw地址会直接返回文件内容,SBT可以正常解析其中的Maven仓库结构。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.28 21:22:20