logo
down
shadow

How to set different scalacOptions per Scala version when cross-compiling using Build.scala?


How to set different scalacOptions per Scala version when cross-compiling using Build.scala?

By : Ellie Salander
Date : November 18 2020, 01:01 AM
this will help When building with Scala 2.10 and SBT 0.13.2, I want to have -language:_, but this isn't recognized by Scala 2.9. There's a question about settings different scalacOptions for cross-compilation (Conditional scalacOptions with SBT), but it is about build.sbt. I'm using Build.scala because I'm doing a multi-project build. , In SBT 0.13+ this will work:
code :
def scalacOptionsVersion(scalaVersion: String) = {
  Seq(
    "-unchecked",
    "-deprecation",
    "-Xlint",
    "-Xfatal-warnings",
    "-Ywarn-dead-code",
    "-target:jvm-1.7",
    "-encoding", "UTF-8"
  ) ++ CrossVersion.partialVersion(scalaVersion) match {
         case Some((2, scalaMajor)) if scalaMajor == 9 => Nil
         case _ => Seq("-language:_")
       }
}


val appSettings = Seq(
  scalacOptions := scalacOptionsVersion(scalaVersion.value)

  // other settings...
)


Share : facebook icon twitter icon
Build.scala: specify scala version does not work

Build.scala: specify scala version does not work


By : Satyesh Tripathi
Date : March 29 2020, 07:55 AM
seems to work fine And let me acknowledge my ignorance: the reason was that I failed to run play command every time I modified Build.scala. The only thing I tried was run, again and again.
How to set scalacOptions used by SBT when compiling Build.scala?

How to set scalacOptions used by SBT when compiling Build.scala?


By : ankush vashishth
Date : March 29 2020, 07:55 AM
it helps some times Sbt is recursive, which means the Build.scala in project directory is build by another definition in its parent directory or build.sbt in the project directory.
Therefore you have to create build.sbt in project directory. In the project/build.sbt you should be able to set scalacOptions ++= Seq("-unchecked", "-feature").
Scala IDE and Apache Spark -- different scala library version found in the build path

Scala IDE and Apache Spark -- different scala library version found in the build path


By : Ofek Bashan
Date : March 29 2020, 07:55 AM
seems to work fine This is often a non-issue, especially when the version difference is small, but there are no guarantees...
The problem is (as stated in the warning) that your project has two Scala libraries on the class path. One is explicitly configured as part of the project; this is version 2.10.2 and is shipped with the Scala IDE plugins. The other copy has version 2.10.4 and is included in the Spark jar.
Conflicting cross-version suffixes in: org.scala-stm:scala-stm

Conflicting cross-version suffixes in: org.scala-stm:scala-stm


By : Mahdi Fardi
Date : March 29 2020, 07:55 AM
Hope that helps It is a known issue on Play:
Conflicting cross-version suffixes in: org.scala-stm:scala-stm
spark build path is cross-compiled with an incompatible version of Scala (2.10.0)

spark build path is cross-compiled with an incompatible version of Scala (2.10.0)


By : Nilesh Patel
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further In your project you are using jars built with different Scala versions; indeed from the log:
Scala IDE uses Scala 2.11.7 Apache Spark 1.5.2 built with Scala 2.10
Related Posts Related Posts :
  • Why there is a ClassCastException when isInstanceOf returns true on a scala type with wildcard parameter?
  • How to reaload scala application after code change using actors and sbt
  • akka non-blocking BoundedMailbox
  • Why are constructor parameters made into members for case classes?
  • Higher order tail recursive function needs to terminate early
  • How can I reusably filter based on type in Scala?
  • Why does Scala sbt update every time I start it from command prompt?
  • Recommended Scala io library
  • Thread-safely transforming a value in a mutable map
  • Why does chaining match expressions does not compile?
  • Ebean not persisting foreign keys
  • Difference between def m(p: T forSome {type T} and def m1(p:Any), is there any ? Explanation needed based on Scala Langu
  • macro does not find out enclosing vals
  • Spark : how to run spark file from spark shell
  • Flattening a list of lists to a set with exceptions in scala
  • flatMap implementation in Scala
  • Confused about a few lines code in a scala official document page
  • How to input parameters when running bash command with Scala
  • Location header is lost if max-redirects > 1
  • Controller Spec is using FakeApplication, but can't load test configuration
  • Scala code analyzer targets case variable names that are identical to the outer matched varables - "suspicous shado
  • Why does authorize directive execute after the code it's supposed to protect?
  • Scala. Checking if a Type is Comparable
  • Does having a private constructor on a value class negate the benefits of a value class?
  • How to transform submitted json in Play 2.0?
  • Scala warning match may not be exhaustive
  • Pure not a member of objective Promise in PlayFramework
  • How to unmarshal POST params and JSON body in a single route?
  • Spark:How to use join method?
  • is client thread-safe in Twitter Finagle
  • Why is the method accepts only one argument?
  • Scala Play 2.3 Working with gCloud Storage - any libs to go async?
  • spray.io strange get/delete/detach directives behavior
  • SBT cannot resolve class declared in src/main/scala in a src/test/scala test class
  • Scala typeclass without function argument
  • Configuring actor behavior using typesafe Config and HOCON
  • Scalatra: Migrating Jersey Filters to Scalatra
  • Compilation error when using Scaldi
  • Scalac hanging in phase typer
  • how to have different source code when cross-compiling Scala with sbt? (changes in MurmurHash)
  • Possible Bug in JDBC?
  • Is there a Scala compiler flag to warn when tail recursion is applied without annotation?
  • scala case class put methods in companion object?
  • multiproject sbt doesn't generate file structure
  • Scala "multilevel" abstract class / abstract objects replacement
  • Scala, getting the type parameters of a KList as an HList
  • Why does Play refuse form reporting "Cannot resolve method apply with such signature: Missing arguments"?
  • How to split string with trailing empty strings in result?
  • Scala group by list of list and subtracts grouped values
  • Scala - Creating a function to produce Unary string or integer values
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org