开发者

Is it possible to reference a project with a different SBT version?

开发者 https://www.devze.com 2023-03-31 08:22 出处:网络
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.

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 messa开发者_如何学Pythonge 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?


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"
0

精彩评论

暂无评论...
验证码 换一张
取 消