1

I am using IDEA 13.1.5 Ultimate edition and sbt 0.13.5 (per Play Activator default config) and here's my current build.sbt:

name := """my-first-app"""

version := "1.0-SNAPSHOT"

lazy val root = (project in file("."))
  .enablePlugins(PlayJava)
  .aggregate(myLibrary)
  .dependsOn(myLibrary)

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

scalaVersion := "2.11.1"

libraryDependencies ++= Seq(
  javaJdbc,
  javaEbean,
  cache,
  javaWs
)

libraryDependencies ++= Seq(
  "net.sf.jsefa" % "jsefa" % "1.1.1.RELEASE"
)

I am seeing two issues:

1) sbt is for some reason trying to resolve wrong version of myLibrary project - for some reason it's trying to resolve 0.1-SNAPSHOT instead of what 1.0-SNAPSHOT version (which is what I would expect); for example, sbt update returns this:

[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: mylibrary#mylibrary_2.11;0.1-SNAPSHOT: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[trace] Stack trace suppressed: run 'last root/*:update' for the full output.
[error] (root/*:update) sbt.ResolveException: unresolved dependency: mylibrary#mylibrary_2.11;0.1-SNAPSHOT: not found

I cannot understand why - I've done a full-text search on local .ivy repo cache, local .m2 repo cache, the whole project directory, cleaned them all manually, invalidated the IDEA cache + restarted the IDE, and still I cannot find any reference to a file containing 0.1-SNAPSHOT except in the target/ folders which obviously means something is supplying this information but I cannot determine what that is.

I have also tried doing activator clean and then manually deleting target/ folders but I simply don't see where this information is coming from.

2) upon creating the lazy val myLibrary = project line in build.sbt and refreshing the IDEA project, I would expect IDE to create the sbt conventional directory structure in the myLibrary project folder, however, it does nothing. Surely, there must be a way to create this default directory structure instead of me creating the structure manually?

What am I missing here?

4

2 回答 2

2

您只指定了根构建的版本,而不是您的库。0.1-SNAPSHOT如果未指定,则为 sbt 的默认版本。

您要么必须在其中创建一个并build.sbtmyLibrary那里指定版本,要么如果您想使用单个全局版本号,您可以使用version in ThisBuild := "1.0-SNAPSHOT".

IntelliJ 提供了一个选项来自动创建丢失的文件夹,转到首选项,搜索sbt并检查Create directories for empty content roots automatically.

于 2014-10-06T18:32:05.190 回答
0

I was facing similar issue. Sub-projects were not building and the sbt was failing trying to locate to remote repositories, while upgrading to Play 2.3.6 and Scala 2.11.1. Earlier with Play 2.2 and Scala 2.10 everything was working fine. Now I am getting everything working by putting

scalaVersion in ThisBuild := "2.11.1" 

in the root or main build.sbt

于 2014-11-06T03:16:18.667 回答