Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When is crosspaths set to true?

Tags:

sbt

scala-2.11

I failed to find a good documentation about the use and purpose of crosspaths. Can someone point me to the documentation or answer these specific questions.

  1. My Scala version is 2.11.6, but when crosspaths is set to true, I see two source folders - 'scala' and 'scala-2.11'. Shouldn't there be just one of these two? What is the meaning of these two folders?
  2. What code goes in 'scala' and what goes in 'scala-2.11'?
like image 465
adefor Avatar asked Mar 28 '15 05:03

adefor


1 Answers

crossPaths is set to true to enable/disable Cross-Building (and it's true by default).

As of sbt 0.13.8 you're seeing that by default sbt handles source directories per Scala version, to remove the repetition of every project doing this themselves.

So if you have multiple Scala versions you're cross building against, out the box you have source directories where you can put that version-specific code.

But I agree that it's confusing: if you don't have multiple crossScalaVersions there's no need for both a scala and a scala-2.11.

The majority of your code should always live in scala, and if you ever have more than one Scala version you're cross building against and you have version-specific code then use scala-2.11, scala-2.10, etc.

like image 108
Dale Wijnand Avatar answered Sep 23 '22 01:09

Dale Wijnand