score:4
I created an SBT plugin for this.
project/plugins.sbt
resolvers += Resolver.sonatypeRepo("releases")
addSbtPlugin("com.lucidchart" % "sbt-cross" % "1.0")
build.sbt
lazy val foo = (project in file("foo")).dependsOn(baz_2_10).settings(
scalaVersion := "2.10.4"
)
lazy val bar = (project in file("bar")).dependsOn(baz_2_11).settings(
scalaVersion := "2.11.5"
)
lazy val baz = (project in file("baz")).cross
lazy val baz_2_10 = baz("2.10.4")
lazy val baz_2_11 = baz("2.11.5")
It takes a couple more lines, but now everything compiles as expected: sbt foo/compile
works, and sbt bar/compile
works.
You don't have to remember unique commands, you don't have bugs from crossPath := false
, and unlike ++
, this is parallelizable: sbt compile
will compile foo
, bar
, and baz
with the correct Scala versions concurrently.
score:0
I had a similar setup, and got it work like so:
lazy val baz = (project in file("baz")).settings(
crossScalaVersions := Seq("2.10.4", "2.11.4")
)
lazy val bar = (project in file("bar")).dependsOn(baz).settings(
scalaVersion := "2.10.4"
)
lazy val foo = (project in file("foo")).dependsOn(baz).settings(
scalaVersion := "2.11.4"
)
And building with
sbt '++ 2.10.4 baz/compile' 'bar/compile' '++ 2.11.4 baz/compile' 'foo/compile'
score:10
Yevgeniy Mordovkin's proposed solution, to declare crossPaths := false
in the baz project, works.
Another thing you might do, is to prepend a +
before the command: sbt '+ bar/update'
. That will build baz for all declared Scala versions.
Source: stackoverflow.com
Related Query
- How to have SBT subproject with multiple Scala versions?
- How can I manage multiple versions of Scala & SBT in my dev environment?
- sbt with sub-modules and multiple scala versions
- Scala - how to make the SortedSet with custom ordering hold multiple different objects that have the same value by which we sort?
- An umbrella Scala project. How to create multimodules project with multiple versions of scala, and libs?
- How to manage multiple interdependent modules with SBT and IntelliJ IDEA?
- How to support multiple Scala versions in a library
- In scala multiple inheritance, how to resolve conflicting methods with same signature but different return type?
- How do you create scala anonymous function with multiple implicit parameters
- How do you run cucumber with Scala 2.11 and sbt 0.13?
- How to obfuscate fat Scala Jar with Proguard and SBT
- How to emit newer class file versions with Scala (50.0/51.0)?
- How to use scala 2.10 trunk with sbt 0.11.0? (Unresolved dependencies)
- How to implement Java interface in Scala with multiple variable parameter methods (type eraser issue)?
- How to organize code for multiple scala versions and differents dependencies
- How do I build multiple jar files using scala sbt
- How to implement maxBy with multiple max in Scala
- How to combine sbt continuous testing with eclipse scala ide?
- Is it possible to have multi project SBT with version.sbt for each subproject
- how to have different source code when cross-compiling Scala with sbt? (changes in MurmurHash)
- In the scala spray framework, how can I create multiple http clients that have different configurations (e.g., timeouts, retries)
- With Scala 2.10.2, SBT 0.13.0, Specs2 & Play Framework 2.2.1 how can I control logging whilst running tests?
- How can I override settings in subprojects in an SBT project with multiple subprojects
- How to get match type with multiple type parameters to work correctly in Scala 3
- How to copy resources with scala + play + sbt
- How to use sbt to specify dependsOn other module with different scala version?
- How to use SBT with multiple sub project web applications?
- How do I explode multiple columns of arrays in a Spark Scala dataframe when the columns contain arrays that line up with one another?
- How to log commands issued from Intellij with Scala plugin to SBT
- How do parse fixed-position file with multiple sections in Spark using Scala
More Query from same tag
- Function returns the wrong value only when size of array input is 1
- Slick 1.0.0 | Return Expression From For Comprehension
- Spark groupBy agg not working as expected
- Adding field to a JSON using Circe
- Playframework 2.3x: scala.concurrent.Future[play.api.mvc.Result])play.api.mvc.Action[play.api.mvc.AnyContent]
- runcommand is not a memeber of casbah mongocolection
- could not find implicit value for evidence parameter
- Spark: IOException, Stream closed during logging
- Scala Capture Expression Name without a Macro
- Spark: Cogroup RDDs fails in case of huge group
- Pagination in Twilio Java SDK returns only the first page
- What do all of Scala's symbolic operators mean?
- Is there a way to run a test, but not mark the whole suite as failed if it fails?
- json4s: cross field extraction
- Understanding type arguments do not conform to class type parameter bounds error when using Higher kinded type parameter
- Play Framework CSS/JS aggregation
- Splitting a string in spark RDD
- How to cut a for-comprehension short (break out of it) in scala?
- How to ensure that type parameters are different in Scala?
- Singleton Object vs Companion Object in Class
- scala gather a list of pair combination
- Flink: ERROR parse numeric value format
- Is it doable and appropriate to use ScalaCheck directly in applications?
- Best way to remove an element in an XML using anti-xml
- How do you break up long SQL query into multiple lines in Scala?
- Error of source value 1.5 is obsolete and will be removed in a future release
- Enforce that all inputs of some type `T` to methods of a trait `F` have been previously produced by `F` itself
- Cannot find a functor instance for Tuple2K
- Problem install lift framework on Fedora
- Read .csv data in european format with Spark