如何将 com.typesafe.sbt.* 依赖项添加到我的项目中?
How to add com.typesafe.sbt.* dependencies to my project?
我正在玩一个 sbt web 插件,我想在我的项目中重用代码。不幸的是,由于缺少依赖项,我什至无法在我的项目中编译原始代码。这些是进口商品:
import com.typesafe.sbt.jse.SbtJsTask
import com.typesafe.sbt.web.{CompileProblems, LineBasedProblem}
import sbt.Keys._
import sbt._
import xsbti.Severity
None 个可以解决。构建失败并显示 not found: object sbt
之类的消息。我检查了原始项目的 build.sbt
文件,但 libraryDependencies
中没有任何相关内容。
我正在使用 Intellij Idea,奇怪的是,当我在项目视图中展开 External Libraries 时,我可以在 SBT 下找到所有需要的东西: sbt-and-plugins (例如对象 com.typesafe.sbt.web.CompileProblems
在那里,我可以在 class 文件中看到它的定义)。
在我看来,我需要的东西是 sbt 的核心部分,但不知何故它不会加载到项目中。我做错了什么?
简答:from here
编辑 (3):答案:
使用自定义 ivy 解析器:
resolvers += Resolver.url("SBT Plugins", url("https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)
libraryDependencies += ("com.typesafe.sbt" % "sbt-js-engine" % "1.0.2")
.extra(
sbt.mavenint.PomExtraDependencyAttributes.SbtVersionKey -> sbtBinaryVersion.value,
sbt.mavenint.PomExtraDependencyAttributes.ScalaVersionKey -> scalaBinaryVersion.value)
.copy(crossVersion = CrossVersion.Disabled)
如何找到插件 jars:
为了弄清楚 sbt 从哪里下载 jar,我使用了这个(有点笨拙)过程:
首先,我想看看 sbt 在本地存储文件的位置。所以:
sbt "reload plugins" "show fullClasspath" | sed s/\),\ Attributed\(/\n/g
我搜索了输出(或者你可以使用 grep
)。
然后,我删除了文件,并再次执行 sbt:reload plugins
、update
& last update
以查看完整的更新日志。
搜索日志,我发现一行说 sbt 从哪里得到插件。
我正在玩一个 sbt web 插件,我想在我的项目中重用代码。不幸的是,由于缺少依赖项,我什至无法在我的项目中编译原始代码。这些是进口商品:
import com.typesafe.sbt.jse.SbtJsTask
import com.typesafe.sbt.web.{CompileProblems, LineBasedProblem}
import sbt.Keys._
import sbt._
import xsbti.Severity
None 个可以解决。构建失败并显示 not found: object sbt
之类的消息。我检查了原始项目的 build.sbt
文件,但 libraryDependencies
中没有任何相关内容。
我正在使用 Intellij Idea,奇怪的是,当我在项目视图中展开 External Libraries 时,我可以在 SBT 下找到所有需要的东西: sbt-and-plugins (例如对象 com.typesafe.sbt.web.CompileProblems
在那里,我可以在 class 文件中看到它的定义)。
在我看来,我需要的东西是 sbt 的核心部分,但不知何故它不会加载到项目中。我做错了什么?
简答:from here
编辑 (3):答案:
使用自定义 ivy 解析器:
resolvers += Resolver.url("SBT Plugins", url("https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)
libraryDependencies += ("com.typesafe.sbt" % "sbt-js-engine" % "1.0.2")
.extra(
sbt.mavenint.PomExtraDependencyAttributes.SbtVersionKey -> sbtBinaryVersion.value,
sbt.mavenint.PomExtraDependencyAttributes.ScalaVersionKey -> scalaBinaryVersion.value)
.copy(crossVersion = CrossVersion.Disabled)
如何找到插件 jars:
为了弄清楚 sbt 从哪里下载 jar,我使用了这个(有点笨拙)过程:
首先,我想看看 sbt 在本地存储文件的位置。所以:
sbt "reload plugins" "show fullClasspath" | sed s/\),\ Attributed\(/\n/g
我搜索了输出(或者你可以使用 grep
)。
然后,我删除了文件,并再次执行 sbt:reload plugins
、update
& last update
以查看完整的更新日志。
搜索日志,我发现一行说 sbt 从哪里得到插件。