Bjorn Roche
Bjorn Roche

Reputation: 11469

Play 2.x application runs locally but fails with "Failed Downloads" on Heroku

When Running my application locally everything works fine. I even ran

rm -r ~/.m2 

To make sure I was redownloading everything. When I deploy to Heroku, however, Heroku reports that it's unable to download commons-codec. I don't think this is an intermittent issue with the repo since the repo has been up. (of course, it could be an intermittent issue with Heroku...)

I was unable to find anything I understood with google (I still a bit unclear on exactly how sbt works). Any idea how I can get up and running again on Heroku?

[warn]  [NOT FOUND  ] commons-codec#commons-codec;1.5!commons-codec.jar (9ms)
   [warn] ==== Typesafe Releases Repository: tried
   [warn]   http://repo.typesafe.com/typesafe/releases/commons-codec/commons-codec/1.5/commons-codec-1.5.jar
   [info] downloading http://repo.typesafe.com/typesafe/releases/org/apache/httpcomponents/httpclient/4.1/httpclient-4.1.jar ...
   [info]   [SUCCESSFUL ] org.apache.httpcomponents#httpclient;4.1!httpclient.jar (101ms)
   [info] downloading http://repo.typesafe.com/typesafe/releases/org/apache/httpcomponents/httpcore/4.1/httpcore-4.1.jar ...
   [info]   [SUCCESSFUL ] org.apache.httpcomponents#httpcore;4.1!httpcore.jar (90ms)
   [info] downloading http://s3pository.heroku.com/maven-central/org/apache/httpcomponents/httpclient/4.1.2/httpclient-4.1.2.jar ...
   [info]   [SUCCESSFUL ] org.apache.httpcomponents#httpclient;4.1.2!httpclient.jar (457ms)
   [info] downloading http://s3pository.heroku.com/maven-central/org/apache/httpcomponents/httpcore/4.1.3/httpcore-4.1.3.jar ...
   [info]   [SUCCESSFUL ] org.apache.httpcomponents#httpcore;4.1.3!httpcore.jar (450ms)
   [warn]   ::::::::::::::::::::::::::::::::::::::::::::::
   [warn]   ::              FAILED DOWNLOADS            ::
   [warn]   :: ^ see resolution messages for details  ^ ::
   [warn]   ::::::::::::::::::::::::::::::::::::::::::::::
   [warn]   :: commons-codec#commons-codec;1.5!commons-codec.jar
   [warn]   ::::::::::::::::::::::::::::::::::::::::::::::
   [error] {file:/tmp/build_19dmxderfnxd/}Xonami WWW/*:update: sbt.ResolveException: download failed: commons-codec#commons-codec;1.5!commons-codec.jar

My build.scala contains:

val appDependencies = Seq(
  "org.hibernate" % "hibernate-c3p0" % "4.1.7.Final",
  "org.hibernate" % "hibernate-entitymanager" % "4.1.7.Final",
  "javax.servlet"  % "servlet-api"  % "2.5",
  "spy"  % "spymemcached"  % "2.7.3",
  "postgresql"  % "postgresql"  % "9.1-901.jdbc4",
  "org.slf4j"  % "slf4j-api"  % "1.6.4",
  "javax.mail"  % "mail"  % "1.4.4",
  "com.thoughtworks.xstream"  % "xstream"  % "1.4.2",
  "org.slf4j"  % "slf4j-simple"  % "1.6.4",
  "org.jdom"  % "jdom"  % "1.1",
  "junit"  % "junit"  % "4.10",
  "com.amazonaws"  % "aws-java-sdk"  % "1.3.6",
  "joda-time"  % "joda-time"  % "2.1",
  "org.restlet.jee"  % "org.restlet"  % "2.1-RC3",
  "org.restlet.jse"  % "org.restlet.ext.jetty"  % "2.1-RC3",
  "org.restlet.jee"  % "org.restlet.ext.json"  % "2.1-RC3",
  "org.restlet.jee"  % "org.restlet.ext.servlet"  % "2.1-RC3",
  "org.restlet.jee"  % "org.restlet.ext.xml"  % "2.1-RC3",
  "org.restlet.jee"  % "org.restlet.ext.xstream"  % "2.1-RC3",
  "org.restlet.jee"  % "org.restlet.ext.wadl"  % "2.1-RC3",
  "xalan"  % "xalan"  % "2.7.1",
  "com.rabbitmq"  % "amqp-client" % "3.0.2"
)

val main = PlayProject(appName, appVersion, appDependencies).settings(defaultScalaSettings:_*).settings(
    resolvers += "spy" at "http://files.couchbase.com/maven2/",
    resolvers += "project.local" at "file:${project.basedir}/repo",
    resolvers += "repository.jboss.org-public" at "https://repository.jboss.org/nexus/content/groups/public",
    resolvers += "maven-restlet" at "http://maven.restlet.org"
)

The problem started when I added rabbitmq, but seems to persist even when I tried removing it.

Upvotes: 1

Views: 1091

Answers (1)

Bjorn Roche
Bjorn Roche

Reputation: 11469

I came across this thread which suggested I "fix" this by changing my PlayProject function as follows:

val main = PlayProject(appName, appVersion, appDependencies).settings(defaultScalaSettings:_*).settings(
    resolvers := Seq("typesafe" at "http://repo.typesafe.com/typesafe/repo"),
    resolvers += "spy" at "http://files.couchbase.com/maven2/",
    resolvers += "project.local" at "file:${project.basedir}/repo",
    resolvers += "repository.jboss.org-public" at "https://repository.jboss.org/nexus/content/groups/public",
    resolvers += "maven-restlet" at "http://maven.restlet.org"
)

I don't really like this, because I don't understand it. I feel like I'm working around a problem with Heroku. Can someone explain why this works and why it's correct (or incorrect)?

Upvotes: 4

Related Questions