我正在尝试在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
答案 0 :(得分:3)
我相信,我有同样的问题,这是因为我的git根目录与你的项目根目录不一致。这也是我的项目结构:
-gitRoot
|___projectDirectory
|____code...
|____Procfile
|____pom.xml
因为我们正在使用git push heroku master
或类似的,所以Heroku(在收到我们的项目时)假定git的根目录是项目的根目录。然后,它会在gitRoot
中查找pom.xml
和Procfile
。当它找不到它们时,你会看到我们熟悉的错误。
我只是将.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根目录。
我希望有人觉得这很有帮助。
答案 1 :(得分:0)
你需要将war文件和pom.xml放在一个目录中并且它有效。 使用dropbox部署enter image description here