我正在调查Heroku作为一个平台,并试图获得一个基本的Java Web应用程序来运行它。该webapp已经建立并运行于Maven(使用Tomcat和cargo-maven插件),所以我认为这应该是一件轻而易举的事,因为Heroku使用Maven来管理其安装/部署任务。Heroku - 我可以从Procfile调用Maven吗?
但事实并非如此,因为我无法让事情真正开始。我Procfile
已经在它下面:
web: sh ./startServer-heroku.sh
而且startServer-heroku.sh
就是:
mvn clean install cargo:start -Dcargo.maven.wait=true
这工作得很好,当我在本地测试使用foreman start
命令,如Heroku的教程文档描述。但是,当我尝试它的实际Heroku的服务器上,我得到以下日志消息:
2011-11-09T02:30:27+00:00 heroku[web.1]: State changed from created to starting
2011-11-09T02:30:27+00:00 heroku[slugc]: Slug compilation finished
2011-11-09T02:30:33+00:00 heroku[web.1]: Starting process with command `sh ./startServer-heroku.sh`
2011-11-09T02:30:33+00:00 app[web.1]: ./startServer-heroku.sh: 1: mvn: not found
2011-11-09T02:30:33+00:00 heroku[web.1]: Process exited
2011-11-09T02:30:34+00:00 heroku[web.1]: State changed from starting to crashed
看来,mvn
是上无处可寻了系统的PATH
,所以命令失败。
是否可以从Heroku Procfile
中调用mvn
?并且是否有任何有Procfile
不可用的命令清单?
看一下[jcabi-heroku-maven-plugin](http://www.jcabi.com/jcabi-heroku-maven-plugin/index.html),它将整个部署过程自动化到Heroku。也许它会帮助你的情况。 – yegor256