是否可以引用具有不同 SBT 版本的项目?

发布于 2024-12-01 14:20:59 字数 1059 浏览 1 评论 0原文

我有 我的项目 (仅用于实验sbt)基于 sbt 0.10。还有 另一个 我想用作依赖项。它基于 sbt 0.7。

目前我正在尝试使用 uri 参考。但构建失败了,可能是因为这些项目中的 sbt 版本不兼容。错误信息是:

[info] Compiling 1 Scala source to /home/zan/.sbt/staging/113d72bca54918c1f033/project/plugins/target/scala-2.8.1.final/classes...
[error] /home/zan/.sbt/staging/113d72bca54918c1f033/project/plugins/Plugins.scala:1: not found: value sbt
[error] import sbt._
[error]        ^
[error] /home/zan/.sbt/staging/113d72bca54918c1f033/project/plugins/Plugins.scala:3: too many arguments for constructor Object: ()java.lang.Object
[error] class Plugins(info: ProjectInfo) extends PluginDefinition(info)  {
[error]              ^

...等等。

我是否可以以某种方式引用第二个项目,以便仅用一个命令就可以构建和/或运行我的项目?

I have my project (just for experiments with sbt) which is based on sbt 0.10. And another one which I want to use as a dependency. It is sbt 0.7 based.

Currently I'm trying to include the second it into my project project using uri reference. But the build is failing, probably because of incompatible versions of sbt in these projects. The error message is:

[info] Compiling 1 Scala source to /home/zan/.sbt/staging/113d72bca54918c1f033/project/plugins/target/scala-2.8.1.final/classes...
[error] /home/zan/.sbt/staging/113d72bca54918c1f033/project/plugins/Plugins.scala:1: not found: value sbt
[error] import sbt._
[error]        ^
[error] /home/zan/.sbt/staging/113d72bca54918c1f033/project/plugins/Plugins.scala:3: too many arguments for constructor Object: ()java.lang.Object
[error] class Plugins(info: ProjectInfo) extends PluginDefinition(info)  {
[error]              ^

... and so on.

Can I somehow reference the second project so it will be possible to bild and/or run my project with just one command?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

残疾 2024-12-08 14:20:59

仅当两个项目都使用 SBT 0.10 时,才支持 SBT 跨项目引用。但是您可以使用publish和artifact,并通过Ivy从下游项目依赖它。

在第一个项目中发出 publish-local 命令将代码打包到 JAR 中并将其写入 ~/.ivy2/local/org.abc.def/...

在 SBT 0.10 项目中,添加以下设置:

libraryDependencies += "org.abc" %% "def" % "0.1"

SBT cross-project references are only supported if both projects use SBT 0.10. But you can use publish and artifact and depend on this from the downstream project through Ivy.

Issue the publish-local command in the first project to package the code in a JAR and write it to ~/.ivy2/local/org.abc.def/....

In the SBT 0.10 project, add this setting:

libraryDependencies += "org.abc" %% "def" % "0.1"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文