kriskanya
kriskanya

Reputation: 697

heroku - dependency issue causing Scala Play build to fail on heroku

I'm a bit of newbie to the Scala and the Play framework (2.6.x). See git push heroku master failure screenshot below.

I'm requiring the jsoup dependency in build.sbt (the first one):

libraryDependencies += "org.jsoup" % "jsoup" % "1.11.3"
libraryDependencies += guice
libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "3.1.2" % Test

And using it in my controller:

import org.jsoup.Jsoup
import org.jsoup.nodes.Document

...

val res = scala.io.Source.fromURL(data.url)("ISO-8859-1").mkString
val s = Jsoup.parse(res).title

In addition I attempted to use it as an unmanaged dependency by adding it to the lib/ folder, though I still get the same Heroku error.

Interestingly, the app works OK and without errors locally. Is there something I'm missing? Thanks.

Edit:

Beginning of build log: enter image description here

Failure: enter image description here

Upvotes: 0

Views: 79

Answers (1)

ygor
ygor

Reputation: 1756

My guess is, that you created Play project from a template. Initial template contains both build.sbt but also gradle build (build.gradle, gradlew, gradlew.bat. Locally, you use sbt for compilation. However, Heroku picks up Gradle build.

Problem: You added the dependency only to build.sbt, but not into gradle.build file.

If you do not really need Gradle, than I suggest to delete Gradle build files from your repository and try to push again.

If you want to keep Heroku using Gradle, than you have to maintain both types of build files.

There also probably is a way how to instruct Heroku to use sbt as preferred choice.

Upvotes: 1

Related Questions