Play Framework 2.3.6 (Java) javascripts and stylesheets not found when deploying to Heroku

I recently updated the Play Framework 2.3.6 (Java version) version 2.2.x following the migration guide . Locally, my app works as expected, but when deployed to Heroku, the javascripts and stylesheets are missing from the /assets/

. My javascripts are in public/javascripts/

, and my stylesheets are generated from LESS files in app/assets/stylesheets/

.

Both plugins.sbt

and build.sbt

have changed a lot since upgrading to Play Framework 2.3.x, so I've included both below. Maybe the error was found somewhere there?

My plugins.sbt

:

// Comment to get more information during initialization
logLevel := Level.Warn

// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.6")

// Use LESS
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.4")

// Use JSHint to validate javascript
addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.1")

// Use RequireJS to (among other things) minify javascript
addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.5")

addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-uglify" % "1.0.3")

      

My build.sbt

:

import com.typesafe.sbt.less.Import.LessKeys
import play.PlayJava

name := "myApp"

version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayJava,SbtWeb)

pipelineStages := Seq(rjs, digest, gzip)

scalaVersion := "2.11.1"

val appName = "myApp"
val appVersion = "1.0-SNAPSHOT"

javaOptions ++= Seq("-Xms128m", "-Xmx384m", "-Xss512k", "-XX:+UseCompressedOops")

libraryDependencies ++= Seq(
  javaJdbc,
  javaEbean,
  javaWs,
  cache,
  "be.objectify" %% "deadbolt-java" % "2.3.1",
  "postgresql" % "postgresql" % "9.1-901-1.jdbc4",
  "com.feth" %% "play-easymail" % "0.6.6-SNAPSHOT",
  filters,
  "com.amazonaws" % "aws-java-sdk" % "1.8.9.1",
  "org.avaje.ebeanorm" % "avaje-ebeanorm" % "3.3.3",
  "com.typesafe.play" % "play-ebean-33-compat" % "1.0.0",
  "org.avaje.ebeanorm" % "avaje-ebeanorm-agent" % "3.2.2",
  "commons-io" % "commons-io" % "2.4",
  "net.sourceforge.htmlunit" % "htmlunit" % "2.15"
)

includeFilter in (Assets, LessKeys.less) := "*.less"

excludeFilter in (Assets, LessKeys.less) := "_*.less"

LessKeys.compress in Assets := true

dependencyOverrides += "org.avaje.ebeanorm" % "avaje-ebeanorm" % "3.3.3"

dependencyOverrides += "org.avaje.ebeanorm" % "avaje-ebeanorm-agent" % "3.2.2"

resolvers ++= Seq(
    Resolver.url("Objectify Play Repository", url("http://deadbolt.ws/releases/"))(Resolver.ivyStylePatterns),
    Resolver.url("Objectify Play Snapshot Repository", url("http://schaloner.github.com/snapshots/"))(Resolver.ivyStylePatterns),
    "play-easymail (release)" at "http://joscha.github.com/play-easymail/repo/releases/",
    "play-easymail (snapshot)" at "http://joscha.github.com/play-easymail/repo/snapshots/"
)

      

+3


source to share


1 answer


Replace pipelineStages := Seq(rjs, digest, gzip)

with pipelineStages := Seq(uglify, digest, gzip)

. Not sure why this works, but it worked for me.



+2


source







All Articles