Java web app on Heroku: Unable to access jarfile

Instead of mvn install do mvn package to know the difference check http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html

Deploying a WAR file with the Heroku Maven plugin allows you to integrate the deployment process with your existing Maven process. The Heroku plugin uses the artifacts generate by your mvn package phase, and builds them into a Slug file that is uploaded to the Heroku servers.

In this way, the Heroku Maven plugin avoids the overhead of recompiling your project remotely. This is often the preferred approach when deploying from a CI server, which may already have built your WAR file and tested it.

Source: https://devcenter.heroku.com/articles/war-deployment#deployment-with-the-heroku-maven-plugin

Regarding deploying Spring Boot, there are some steps to be taken:

  • Configure port

    web: java -Dserver.port=$PORT -jar target/demo-0.0.1-SNAPSHOT.jar

  • Specify JDK, default is 1.8 (No need to change if 1.8 is specified in Maven)

Check http://docs.spring.io/spring-boot/docs/current/reference/html/cloud-deployment-heroku.html

To execute Procfile use heroku local


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.