I'm trying to deploy my Java Spring Boot web application to Heroku.
To launch it locally I run:
mvn install
and then
java $JAVA_OPTS -jar target/*.war
So for Heroku I've created the Procfile:
web: java $JAVA_OPTS -jar target/*.war
I use Heroku Github integration and the application is deployed to Heroku from Github. So I just push it there.
But the application doesn't launch.
heroku logs --app myapp
gives me:
2015-09-09T21:53:25.581128+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -jar target/*.war`
2015-09-09T21:53:27.110820+00:00 app[web.1]: Error: Unable to access jarfile target/*.war`
heroku run bash --app myapp
with ls -a
doesn't show target
directory.
I think Heroku doesn't build the app. But what am I doing wrong? Thanks in advance for you advices!
I found the cause of the error. Here is a part of build log:
-----> Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
Detected buildpacks: Node.js, Java
See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
-----> Node.js app detected
-----> Creating runtime environment
According to Heroku build order the application was considered as NodeJS one. So the solution was to set java build pack:
heroku buildpacks:set https://github.com/heroku/heroku-buildpack-java
And then push any change to application to make it rebuilt.