0

I have noticed that as soon as I add scala-js to a project in which I use sbt-start-script my default settings are overwritten with scala.js specific values. Seems that once I add a reference to an object that extends the JsApp it gets set as the MAINCLASS in the generated start script. Below is the code to reproduce the problem:

Build.scala:

import sbt._
import Keys._
import com.typesafe.sbt.SbtStartScript
import scala.scalajs.sbtplugin.ScalaJSPlugin._
import ScalaJSKeys._

object ScalizateBuild extends Build {
  val Name = "test"
  val Version = "0.1.0-SNAPSHOT"
  val ScalaVersion = "2.11.4"

        lazy val project = Project (
    "test",
    file("."),
    settings = Defaults.defaultSettings
        ++ SbtStartScript.startScriptForClassesSettings
        ++ scalaJSSettings
        ++ Seq(
      name := Name,
      version := Version,
      scalaVersion := ScalaVersion,
      resolvers += Classpaths.typesafeReleases,
      libraryDependencies ++= Seq(
      )))

}

plugins.sbt:

addSbtPlugin("com.typesafe.sbt" % "sbt-start-script" % "0.10.0")

addSbtPlugin("org.scala-lang.modules.scalajs" % "scalajs-sbt-plugin" % "0.5.6")

Test.scala:

import scala.scalajs.js.JSApp

object JQueryUIApp extends JSApp {

        def main(): Unit = {
                println("javascript")
        }
}
user79074
  • 4,937
  • 5
  • 29
  • 57
  • 4
    It seems to me you're trying to have both a JVM and a JS plugin in one single sbt project. That's not possible. See http://stackoverflow.com/questions/27505957/using-scala-js-to-compile-only-and-not-override-run-in-sbt . If this is not what you're trying to do, then I don't understand what it is you *do* expect sbt-start-script to do in the context of a Scala.js project. – sjrd Jan 21 '15 at 23:51
  • Multiple projects probably the way to go alright – user79074 Jan 22 '15 at 10:45

0 Answers0