1

I have old and big Java project in which I want to start using Scala. All Java sources are stored in /src. Unfortunately I cannot move them to standard /src/main/java directory because there are tons of old Ant scripts and etc.

So my goal is to have new Scala source and resources in /srcnew and keep Java stuff in /src. So I wrote following in build.scala

sourceDirectory := baseDirectory.value / "srcnew",
javaSource := baseDirectory.value / "src",

And it doesn't work :) SBT doesn't see source in javaSource at all.

What am I missing ?

expert
  • 29,290
  • 30
  • 110
  • 214
  • 1
    Maybe just symlink it? – Chris Martin Jan 19 '15 at 00:34
  • Have you seen ["Customizing paths"](http://www.scala-sbt.org/0.13/docs/Howto-Customizing-Paths.html) in the SBT docs? – Chris Martin Jan 19 '15 at 00:36
  • @ChrisMartin Actually not bad idea :) I'll talk to guys tomorrow. But I suspect it might be hard to do because it will require manual action on multiple build servers and on every developer's machine. – expert Jan 19 '15 at 00:37
  • Why, what kind of version control are you using? You can check symlinks into a git repo. – Chris Martin Jan 19 '15 at 00:38
  • @ChrisMartin We're using GitHub but according to this question http://stackoverflow.com/questions/5917249/git-symlinks-in-windows making git symlinks in Windows is phenomenal pain. – expert Jan 19 '15 at 00:53
  • 1
    Ah, I forgot about Windows ;) – Chris Martin Jan 19 '15 at 00:54
  • @ChrisMartin It's offtopic but while we're on the subject could you please take a look at http://stackoverflow.com/q/28016458/226895 ? – expert Jan 19 '15 at 00:56
  • Have you tried replacing `javaSource` with `javaSource in Compile` like in the documentation? – Chris Martin Jan 19 '15 at 00:59

1 Answers1

0

These are the examples from "Customizing paths" in the SBT docs:

scalaSource in Compile := baseDirectory.value / "src"

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

javaSource in Compile := baseDirectory.value / "src"

javaSource in Test := baseDirectory.value / "test-src"

So in your case it would be

sourceDirectory in Compile := baseDirectory.value / "srcnew"

javaSource in Compile := baseDirectory.value / "src"
Chris Martin
  • 30,334
  • 10
  • 78
  • 137