Nunovsky
Nunovsky

Reputation: 395

Pushing my repository (JAVA app) to heroku fails

Im building an app in playframework 2.2., and when I run the app locally with play run it runs fine but when I try to upload to heroku with git push heroku master it starts uploading fine but after a while it always ends with these errors:

       [info] downloading http://s3pository.heroku.com/maven-central/org/par
ed/parboiled-core/1.1.5/parboiled-core-1.1.5.jar ...
       [info]   [SUCCESSFUL ] org.parboiled#parboiled-core;1.1.5!parboiled-c
jar(bundle) (245ms)
       [info] downloading http://s3pository.heroku.com/maven-central/org/ow2
/asm/4.1/asm-4.1.jar ...
       [info]   [SUCCESSFUL ] org.ow2.asm#asm;4.1!asm.jar (198ms)
       [info] downloading http://s3pository.heroku.com/maven-central/org/ow2
/asm-tree/4.1/asm-tree-4.1.jar ...
       [info]   [SUCCESSFUL ] org.ow2.asm#asm-tree;4.1!asm-tree.jar (109ms)
       [info] downloading http://s3pository.heroku.com/maven-central/org/ow2
/asm-analysis/4.1/asm-analysis-4.1.jar ...
       [info]   [SUCCESSFUL ] org.ow2.asm#asm-analysis;4.1!asm-analysis.jar
ms)
       [info] downloading http://s3pository.heroku.com/maven-central/org/ow2
/asm-util/4.1/asm-util-4.1.jar ...
       [info]   [SUCCESSFUL ] org.ow2.asm#asm-util;4.1!asm-util.jar (354ms)
       [info] downloading http://s3pository.heroku.com/maven-central/org/sca
ang/scala-compiler/2.10.3/scala-compiler-2.10.3.jar ...
       [info]   [SUCCESSFUL ] org.scala-lang#scala-compiler;2.10.3!scala-com
r.jar (8070ms)
       [info] downloading http://s3pository.heroku.com/maven-central/org/sca
ang/jline/2.10.3/jline-2.10.3.jar ...
       [info]   [SUCCESSFUL ] org.scala-lang#jline;2.10.3!jline.jar (307ms)
       [info] Done updating.
       [info] Compiling 5 Scala sources and 11 Java sources to /tmp/scala_bu
ack_build_dir/target/scala-2.10/classes...
       [info] 'compiler-interface' not yet compiled for Scala 2.10.3. Compil
..
       [info]   Compilation completed in 23.023 s
       [error] /tmp/scala_buildpack_build_dir/app/utils/DatabaseConnection.j
45: illegal start of type
       [error]         List<String> results = new ArrayList<>();
       [error]                                              ^
       [error] 1 error
       [error] (compile:compile) javac returned nonzero exit code
       [error] Total time: 387 s, completed Mar 25, 2014 4:20:51 PM
 !     Failed to build app with sbt

 !     Push rejected, failed to compile Play 2.x - Java app

To [email protected]:glacial-plateau-2895.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:glacial-plateau-2895.git'

Can someone help me? I've searched but i didn't find similar problems that could help me.

Thanks in advance.

Upvotes: 2

Views: 2817

Answers (2)

stratzoomer
stratzoomer

Reputation: 146

If you want to use java 7 on Heroku, you'll need to add a file with a directive in the root folder of your project. Details here - https://devcenter.heroku.com/articles/add-java-version-to-an-existing-maven-app

Upvotes: 0

fge
fge

Reputation: 121740

   [error] /tmp/scala_buildpack_build_dir/app/utils/DatabaseConnection.java:45:
               illegal start of type
   [error]         List<String> results = new ArrayList<>();
   [error]                                             ^

Means that the JDK on your Heroku environment is Java 6 whereas your code is Java 7. Upgrade ;)

Here's info how to...

Upvotes: 2

Related Questions