-1

I am trying to deploy Spring Boot application to Heroku but I am not able to do that. My application is automatically get detected as "heroku-maven-plugin" but i want to deploy it as Java Application.

How can I achieve this?

Vijay
  • 228
  • 3
  • 8
  • 1
    Take a look on it https://dzone.com/articles/spring-boot-heroku-and-cicd – Kayis Rahman May 03 '21 at 06:17
  • getting this error: Exception in thread "main" java.lang.UnsupportedClassVersionError: com/development/searchbooks/SearchBooksApplication has been compiled by a more recent version of the Java Runtime (class file version 58.0), this version of the Java Runtime only recognizes class file versions up to 52.0 – Vijay May 03 '21 at 06:43
  • I am not able to override the jdk version of heroku which is 1.8 – Vijay May 03 '21 at 06:48
  • 1
    See this https://stackoverflow.com/questions/53604111/heroku-cannot-deploy-java-11-spring-boot-app – Kayis Rahman May 03 '21 at 06:54
  • State changed from crashed to starting 2021-05-03T07:06:31.599486+00:00 heroku[web.1]: Starting process with command `java -jar --server.port=21791 target/search-books-0.0.1-SNAPSHOT.war` 2021-05-03T07:06:34.655559+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them. 2021-05-03T07:06:34.660959+00:00 app[web.1]: Error: Unable to access jarfile target/search-books-0.0.1-SNAPSHOT.war – Vijay May 03 '21 at 07:11
  • 1
    @KayisRahman Your links helped me alot. Thank you – Vijay May 03 '21 at 10:06

1 Answers1

1

I got the answer for this issue.

  • Added system.properties file at the root folder path

    java.runtime.version=14
    
  • deployed app through heroku-cli-deploy

    Step 1: mvn clean
    Step 2: mvn build
    Step 3: heroku deploy:jar target/*.jar --app <app-name>
    
Vijay
  • 228
  • 3
  • 8