[英]Heroku cannot detect the buildpack - Spring Boot
我正在嘗試在作為Spring Boot項目(Java)的Heroku上部署Web服務,當我嘗試推送到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
我曾經遇到過同樣的問題,這是由於我的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根目錄。
我希望有人覺得這有幫助。
您需要將war文件和pom.xml放在一個目錄中,並且可以正常工作。 使用保管箱部署此處輸入圖像描述
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.