Heroku Spring Boot Example With Maven
ssh-keygen -t rsa
heroku keys:add
heroku create your-application-name
Here I'm listing the most important configurations of Spring Boot
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.version}</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<finalName>${artifactId}</finalName>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<finalName>${artifactId}</finalName>
</configuration>
</plugin>
finalName in spring-boot-maven-plugin and maven-jar-plugin, are very important to fix the name of JAR file, so we can configure the Procfile.
The repackage goal, repackaging an application as an executable JAR/WAR as well as a goal for running the application.
Create Procfile with the content
web: java -Dserver.port=$PORT -jar target/spring-boot-heroku.jar
git push heroku master
Access the Spring Actuator API:
https://your-application-name.herokuapp.com/health
or
curl https://your-application-name.herokuapp.com/health
Hot deploy on Heroku...