سؤال

How do I configure an extra folder for sbteclipse to include? I have a default sbt directory layout with an additional it/scala folder. I want that folder to be included in the generated .project and .classpath files, but I don't know how to do that....

هل كانت مفيدة؟

المحلول

You can achieve this for example by adding something like the following to your build.sbt:

unmanagedSourceDirectories in Compile <++= baseDirectory { base =>
  Seq(
    base / "some/subdir/src"
  )
}

For details of the relation between unmanaged-sources, unmanaged-source-directories and scala-source you might want to check the documentation. After exporting the eclipse project from sbt, you should find a corresponding entry in your .classpath file, like:

  <classpathentry output="target/scala-2.9.1/classes" path="some/subdir/src" kind="src"></classpathentry>

نصائح أخرى

there can be case in which you may just want to add a folder say conf to the eclipse classpath which contains configurations required at runtime. Below is the trick -

unmanagedJars in Compile ++= {
    val confBase = (baseDirectory.value ** "conf")
    confBase.classpath
}

if you want to add, e.g., the folder src/folderXYZ, then add to build.sbt:

Compile / unmanagedSourceDirectories += baseDirectory.value / "src/folderXYZ"
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top