导入sbt文件导致奇怪的源根

时间:2015-05-10 06:02:28

标签: scala intellij-idea sbt

我的项目看起来像:

my-project
  project/plugins.sbt
  build.sbt
  src
    main/scala/com/my-project/...
    test/scala/com/my-project/...

我从最初具有类似以下内容的目录结构的项目中分叉了这个:

my-project
  project/plugins.sbt
  build.sbt
  src/com/my-project/...

没有测试目录,所以我尝试重新组织它以遵循标准的Maven约定。添加行

scalaSource in Test := baseDirectory.value / "src" / "test" / "scala"

my-project/build.sbt执行我的预期,导致myproject/src/test/scala被标记为测试源root,当我点击"刷新所有SBT项目"在SBT工具窗口中。但是,无论我添加什么,我都无法将源根目录移出my-project/src。目前,我已添加以下内容:

sourceDirectory := baseDirectory.value / "src" / "main" / "scala"
sourceDirectory in Scope.GlobalScope := baseDirectory.value / "src" / "main" / "scala"
sourceDirectory in Compile := baseDirectory.value / "src" / "main" / "scala"

scalaSource := baseDirectory.value / "src" / "main" / "scala"
scalaSource in Scope.GlobalScope :=  baseDirectory.value / "src" / "main" / "scala"
scalaSource in Compile :=  baseDirectory.value / "src" / "main" / "scala"

scalaSource in Test := baseDirectory.value / "src" / "test" / "scala"

我做错了什么?我使用最新的(14.1.2)版本的IntelliJ,使用Scala插件,以及版本0.13.8的sbt。

编辑:原始项目是hello-scaloid-sbt,原始未经编辑的sbt文件就在那里。完整的是:

import android.Keys._

javacOptions ++= Seq("-source", "1.7", "-target", "1.7")

android.Plugin.androidBuild

name := "hello-scaloid-sbt"

scalaVersion := "2.11.6"

proguardCache in Android ++= Seq(
  ProguardCache("org.scaloid") % "org.scaloid"
)

proguardOptions in Android ++= Seq("-dontobfuscate", "-dontoptimize", "-keepattributes Signature", "-printseeds target/seeds.txt", "-printusage target/usage.txt"
  , "-dontwarn scala.collection.**" // required from Scala 2.11.4
  , "-dontwarn org.scaloid.**" // this can be omitted if current Android Build target is android-16
)

libraryDependencies += "org.scaloid" %% "scaloid" % "4.0-RC1" withSources() withJavadoc()

scalacOptions in Compile += "-feature"

run <<= run in Android

install <<= install in Android

retrolambdaEnable in Android := false

上面的行(所有scalaSource选项等)已经插入到libraryDependencies和scalacOptions之间。

1 个答案:

答案 0 :(得分:0)

问题似乎是由android-sdk-plugin引起的,tests对源根应该在哪里有自己的想法。我放弃并重组了我的项目,以便$ x86_64-w64-mingw32-g++ main.cpp -o hello.exe -static-libgcc -static-libstdc++ -static "/usr/x86_64-w64-mingw32/lib/libcurl.a" -lpthread 是一个顶级目录。