Re: [sbt] [sbteclipse] Using non standard source directories defined in build.sbt

177 views
Skip to first unread message

Heiko Seeberger

unread,
Oct 31, 2012, 3:29:45 AM10/31/12
to simple-b...@googlegroups.com
Hi,

I think you have to scope your setting of scalaSource:
scalaSource in Compile <<= baseDirectory(_ / "src")
scalaSource in Test <<= baseDirectory(_ / "src")

This should make sbteclipse happy. Please give it a try.

Then use scalaSource properly scoped in your redefinition of unmanagedSources.

Heiko

On Oct 30, 2012, at 7:38 PM, MatthISC <matth...@gmail.com> wrote:

Hi,

I'm new to the scala/sbt world so this question might be totally stupid... But I can't figure it out so I'm asking ;-)

The problem:
I want to import an already existing project with non standard source location defined in the build.sbt (ie, /src instead of the standard src/main/scala or src/main/java directories).
This project already has source file in /src. When importing it into eclipse, after issuing the command "sbt eclipse",
I have the source standard source folder ( src/main/{scala,java} and src/test/{scala,java} ) being empty and the /src folder, with all source files, being a regular folder.
The generated .classpath has :
  <classpathentry output="target/scala-2.9.2/classes" path="src/main/scala" kind="src"></classpathentry>
  <classpathentry output="target/scala-2.9.2/classes" path="src/main/java" kind="src"></classpathentry>
  <classpathentry output="target/scala-2.9.2/test-classes" path="src/test/scala" kind="src"></classpathentry>
  <classpathentry output="target/scala-2.9.2/test-classes" path="src/test/java" kind="src"></classpathentry>
Changing those 4 lines by :
  <classpathentry output="target/scala-2.9.2/classes" path="src" kind="src"></classpathentry>
fixes this.

More information :
The project can be obtained with giter8: in a terminal, with giter8 being installed : g8 inkytonik/kiama.g8
See : https://github.com/inkytonik/kiama.g8/tree/master/src/main/g8
I use sbt launcher version 0.12.1

The question:
can sbteclipse generates the right classpath ?
Or is it stuck with standard directories ?
The build.sbt file has this definition for sources :

  // Source code locations
  // Specify how to find source and test files.  Main sources are
  //    - in src directory
  //    - all .scala files, except
  // Test sources, which are
  //    - files whose names end in Tests.scala, which are actual test sources
  scalaSource <<= baseDirectory { _ / "src" }

  unmanagedSources in Test <<= scalaSource map { s => {
      (s ** "*Tests.scala").get
  }}

  unmanagedSources in Compile <<= (scalaSource, unmanagedSources in Test) map { (s, tests) =>
      ((s ** "*.scala") --- tests).get
  }

Thanks in advance,
Best regards,
Matth

PS : there's a little bug in the doc: the  projectFlavor example is the one from executionEnvironment.

--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To view this discussion on the web visit https://groups.google.com/d/msg/simple-build-tool/-/6xUzeGonVAQJ.
To post to this group, send email to simple-b...@googlegroups.com.
To unsubscribe from this group, send email to simple-build-t...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/simple-build-tool?hl=en.

Tony Sloane

unread,
Nov 7, 2012, 11:35:55 PM11/7/12
to simple-b...@googlegroups.com
Thanks Heiko. I've updated the inkytonik/kiama.g8 project settings along the lines that you suggest.

I'm not an sbteclipse user, though, so can someone try the new version of kiama.g8 with it? I'm happy to fix further if problems still persist.

cheers,
Tony
Reply all
Reply to author
Forward
0 new messages