【问题标题】:Heroku cannot detect the buildpack - Spring BootHeroku 无法检测到 buildpack - Spring Boot
【发布时间】:2015-10-06 14:16:07
【问题描述】:

我正在尝试在 Heroku 上部署我的 Web 服务,这是一个 Spring Boot 项目 (Java),当我尝试推送到 Heroku 时,它给了我以下错误:

Fetching custom git buildpack... done
remote: 
remote:  !     Push rejected, no Cedar-supported app detected
remote: HINT: This occurs when Heroku cannot detect the buildpack
remote:       to use for this application automatically.
remote: See https://devcenter.heroku.com/articles/buildpacks

我尝试使用 Java 的自定义构建包,但仍然无法正常工作。有没有人知道我该如何解决这个问题。任何帮助将非常感激。

我也有 jetty-runner 依赖和插件。我还创建了一个 Procfile,其定义如下:

web: java $JAVA_OPTS -jar target/dependency/jetty-runner.jar --port $PORT target/*.war

我的项目目录如下(不知道有没有关系):

-root
  |___projectDirectory
  |        |____code...
  |        |____Procfile
  |___readme

【问题讨论】:

  • 您的应用程序的根目录中是否有pom.xml 文件?如果 Heroku 没有找到,它会给你no Cedar-supported app detected 错误。
  • 另外,Procfile 需要放在根目录下。
  • @codefinger 好的,现在我将所有内容都放在根目录中,但目标文件夹为空,它没有 pom.xml 或 pom.properties。这对于 Spring Boot 项目是否正常。因为它给了我一个错误,即它无法访问目标/依赖项中的 jetty-runner jar 文件。我认为这与我的目标文件夹为空有关。我该如何解决这个问题?

标签: java spring heroku spring-boot


【解决方案1】:

我相信,我有同样的问题,这是由于我的 git 根目录与您的项目根目录不同造成的。这也是我的项目结构:

-gitRoot
  |___projectDirectory
           |____code...
           |____Procfile
           |____pom.xml 

因为我们使用git push heroku master或类似的,Heroku(在收到我们的项目时)假设git的根目录是项目的根目录。然后它在gitRoot 中查找pom.xmlProcfile。当它没有找到它们时,您会看到我们熟悉的错误。

我只是将我的.git 文件夹和.gitignore 文件移动到projectDirectory 并运行:

git add . -A
git commit -m "Move the git root down to project root."
mvn clean install
git push heroku master

这是一种享受,但不要忘记更新您的.gitignore 文件并在提交下一步之前清除缓存。新的项目结构如下所示。

projectDirectory
           |____code...
           |____Procfile
           |____pom.xml

上面projectDirectory也是git根目录。

我希望有人觉得这很有帮助。

【讨论】:

    【解决方案2】:

    你需要你的战争文件和 pom.xml 在一个目录中,它工作。 使用 dropbox 部署enter image description here

    【讨论】:

      猜你喜欢
      • 2017-01-10
      • 2016-06-22
      • 2016-10-10
      • 1970-01-01
      • 2016-12-04
      • 2018-03-09
      • 2017-08-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多