Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
471 views
in Technique[技术] by (71.8m points)

playframework - Can't use sbt 0.13.7 with Play subprojects

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

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)

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.

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...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

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

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

This works well in 0.13.5, but breaks after that.

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...