是否可以引用具有不同 SBT 版本的项目?
我有 我的项目 (仅用于实验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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
仅当两个项目都使用 SBT 0.10 时,才支持 SBT 跨项目引用。但是您可以使用publish和artifact,并通过Ivy从下游项目依赖它。
在第一个项目中发出
publish-local
命令将代码打包到 JAR 中并将其写入~/.ivy2/local/org.abc.def/...
。在 SBT 0.10 项目中,添加以下设置:
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: