将我的存储库(JAVA应用程序)推送到heroku失败

时间:2014-03-25 16:59:39

标签: java git heroku playframework

我正在playframework 2.2。中构建一个应用程序,当我在本地运行应用程序运行时运行正常,但当我尝试使用 git push heroku master 上传到heroku时,它开始上传很好但是过了一会儿它总是以这些错误结束:

       [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 git@heroku.com:glacial-plateau-2895.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:glacial-plateau-2895.git'

有人能帮助我吗? 我已经搜索过,但我没有找到可以帮助我的类似问题。

提前致谢。

2 个答案:

答案 0 :(得分:2)

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

表示Heroku环境中的JDK是Java 6,而您的代码是Java 7.升级;)

Here's info how to...

答案 1 :(得分:0)

如果你想在Heroku上使用java 7,你需要在项目的根文件夹中添加一个带有指令的文件。详情请点这里 - https://devcenter.heroku.com/articles/add-java-version-to-an-existing-maven-app