I wanted to concatenate JavaScript files in my java application which is built on play framework 2.5.
In plugins.sbt
, I have added the below code:
addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.8")
I also added:
resolvers += Resolver.url("SBT Plugins", url("https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)
resolvers += Resolver.url("bintray-sbt-plugins", url("https://dl.bintray.com/sbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)
In Build.scala
I have added:
pipelineStages := Seq(rjs)
When I run >activator clean dist
I get:
"rjs is undefined"
I tried adding:
import com.typesafe.sbt.rjs.Import._
But there is no rjs
package in com.typesafe.sbt
.
Build.scala
import play.PlayScala
import sbt._
import Keys._
import play.Play.autoImport._
import com.typesafe.sbt._
import com.typesafe.sbt.web.SbtWeb
import de.johoop.jacoco4sbt.JacocoPlugin._
import com.typesafe.sbt.web.Import.pipelineStages
object ApplicationBuild extends Build {
def fromEnv(name: String) = System.getenv(name) match {
case null => None
case value => Some(value)
}
val appName = fromEnv("artifactId").getOrElse("BMT")
val appVersion = fromEnv("version").getOrElse("1.2-SNAPSHOT")
pipelineStages := Seq(rjs)
val appDependencies = Seq(
javaJdbc,
javaCore,
javaJpa,
javaWs,
cache,
javaJpa.exclude("org.hibernate.javax.persistence", "hibernate-jpa-2.0-api"),
"org.hibernate" % "hibernate-entitymanager" % "4.3.5.Final",
"org.mockito" % "mockito-all" % "1.9.5" % "test",
"org.apache.poi" % "poi" % "3.9",
"org.apache.poi" % "poi-ooxml" % "3.9",
"org.json" % "json" % "20090211",
"commons-codec" % "commons-codec" % "1.9",
"org.apache.directory.api" % "api-all" % "1.0.0-M33" exclude("org.apache.directory.api", "api-ldap-schema-data"),
"org.apache.directory.server" % "apacheds-server-annotations" % "2.0.0-M15" % "test" exclude("org.apache.directory.api", "api-ldap-schema-data"),
"org.apache.directory.server" % "apacheds-test-framework" % "2.0.0-M15" % "test" exclude("org.apache.directory.api", "api-ldap-schema-data"),
"com.microsoft.windowsazure" % "microsoft-windowsazure-api" % "0.4.6"
)
val main = Project(appName, file(".")).enablePlugins(play.PlayJava,SbtWeb).settings(
version := appVersion,
libraryDependencies ++= appDependencies
)
}
What I know is how to get the sbt-rjs plugin installed in the application.
There is more than one problem with your
Build.scala
project:Imports
You have imports that do not exists, like:
And also, this one, which I suppose is generating the problem your report:
Problem here is that
rjs
is a subpackage ofcom.typesafe.sbt
and then usingrjs
inside yourBuild.scala
actually references the package instead of the configuration you want. Replace the import above with:And then it will properly reference the
rjs
pipeline stage.Misconfigurations
You have:
But
play.PlayJava
does not exists. The correct line would be:Why not to use
build.sbt
instead. There is nothing special in your build andbuild.sbt
would be simpler: