找不到 pom.xml 文件!请检查它是否存在并已提交给 Git

Hun*_*uan 6 spring-mvc heroku procfile

这是我的项目的文件夹结构:

- Root-folder
    .git
    projecname
        Procfile
        pom.xml
Run Code Online (Sandbox Code Playgroud)

这是Procfile配置:

web:    java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT  --proxy-base-url https://projectname.herokuapp.com target/*.war

Run Code Online (Sandbox Code Playgroud)

我使用 Profile 从本地在 heroku 上部署项目:

cd projectname
git push heroku master
Run Code Online (Sandbox Code Playgroud)

但我在部署时遇到错误:

remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/java.tgz
remote:        Could not find a pom.xml file! Please check that it exists and is committed to Git.
remote: 
remote:        More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure

Run Code Online (Sandbox Code Playgroud)

据我了解,原因是:Heroku用于运行构建的根文件夹与包含is:maven的文件夹相同,文件位于文件夹中。.gitRoot-folderpom.xmlRoot-folder/projectname

所以我的问题是如何设置build path让 heroku 知道包含该pom.xml文件的位置?

先感谢您。


解决了

我读过这篇文章:https://medium.com/@timanovsky/heroku-buildpack-to-support-deployment-from-subdirectory-e743c2c838dd

然后通过命令设置 PROJECT_PATH: heroku config:set PROJECT_PATH=projectname