不能将 sbt 0.13.7 与 Play 子项目一起使用 [英] Can't use sbt 0.13.7 with Play subprojects

查看:17
本文介绍了不能将 sbt 0.13.7 与 Play 子项目一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个由两个子项目(common 和 common2)组成的 示例 Play 2.3.8 项目:

I have a sample Play 2.3.8 project that is composed by two subprojects (common and common2):

$ tree -L 2 .
.
├── build.sbt
├── common
│   ├── app
│   ├── build.sbt
│   ├── conf
├── common2
│   ├── app
│   ├── build.sbt
│   ├── conf
├── conf
│   (...)
├── build.sbt

在主 build.sbt 中,对这两个子项目的依赖定义为:

And in the main build.sbt the dependency to those two subprojects is defined as:

lazy val common = (project in file("common")).enablePlugins(PlayJava)

lazy val common2 = (project in file("common2")).enablePlugins(PlayJava)

lazy val main = (project in file(".")).enablePlugins(PlayJava)
                    .aggregate(common, common2).dependsOn(common, common2)

这按预期工作.现在我试图让这个项目使用 sbt 0.13.7(目前它使用 0.13.5),当我启动激活器时,我总是收到这样的错误(Test 是我的项目的根):

and this works as expected. Now I am trying to make this project use sbt 0.13.7 (currently it uses 0.13.5) and when I start activator I always get a error like this (Test is the root of my project):

[info] Done updating.
java.lang.RuntimeException: No project 'common' in 'file:/home/user/Desktop/Test/'.
Valid project IDs: main
    at scala.sys.package$.error(package.scala:27)
    // OMITTED
    at xsbt.boot.Boot.main(Boot.scala)
[error] No project 'common' in 'file:/home/user/Desktop/Test/'.
[error] Valid project IDs: main
[error] Use 'last' for the full log.

那可能是什么问题?定义子项目的方式有变化吗?我查看了 0.13 中的 更改.5 到 0.13.7 并且找不到与此相关的任何内容...

So what could be the problem? Have the way to define subprojects changed? I have looked at the changes from 0.13.5 to 0.13.7 and can't find nothing related to this...

推荐答案

确实,sbt 0.13.5 和 0.13.6 之间似乎发生了一些变化.在我的示例项目中,我在主 build.sbt 中定义了所有子项目,但也在子项目文件夹中重新定义了它们.

Indeed it seems that something changed between sbt 0.13.5 and 0.13.6. In my sample project I have all the subprojects defined in the main build.sbt, but had also them redefined inside the subprojects folder.

所以以common/build.sbt为例,子项目再次定义为

So in common/build.sbt for example, the subproject is defined again as

lazy val main = (project in file(".")).enablePlugins(PlayJava)

这在 0.13.5 中运行良好,但在那之后就中断了.

This works well in 0.13.5, but breaks after that.

所以解决方案是删除这些行,只在主 build.sbt 中定义子项目.

So the solution was to remove those lines and only define the subprojects in the main build.sbt.

这篇关于不能将 sbt 0.13.7 与 Play 子项目一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆