Error while deploying Spring boot app to Heroku

Pulkit Banta :

I have an issue while deploying my Spring boot app to Heroku.

  • I am trying to deploy it as a java app instead of building and deploying a jar file.
  • I have used the free Postgresql in Heroku.

The error while pushing the app to Heroku master is:

remote:        [INFO] Changes detected - recompiling the module!
remote:        [INFO] Compiling 18 source files to /tmp/build_79201803/target/classes
remote:        [INFO] -------------------------------------------------------------
remote:        [ERROR] COMPILATION ERROR :
remote:        [INFO] -------------------------------------------------------------
remote:        [ERROR] /tmp/build_79201803/src/main/java/com/pukitbanta/springblog/model/post.java:[15,8] class Post is public, should be declared in a file named Post.java
remote:        [ERROR] /tmp/build_79201803/src/main/java/com/pukitbanta/springblog/model/user.java:[12,8] class User is public, should be declared in a file named User.java
remote:        [INFO] 2 errors
remote:        [INFO] -------------------------------------------------------------
remote:        [INFO] ------------------------------------------------------------------------
remote:        [INFO] BUILD FAILURE
remote:        [INFO] ------------------------------------------------------------------------
remote:        [INFO] Total time:  16.300 s
remote:        [INFO] Finished at: 2020-08-11T11:09:38Z
remote:        [INFO] ------------------------------------------------------------------------
remote:        [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project springblog: Compilation failure: Compilation failure:
remote:        [ERROR] /tmp/build_79201803/src/main/java/com/pukitbanta/springblog/model/post.java:[15,8] class Post is public, should be declared in a file named Post.java
remote:        [ERROR] /tmp/build_79201803/src/main/java/com/pukitbanta/springblog/model/user.java:[12,8] class User is public, should be declared in a file named User.java
remote:        [ERROR] -> [Help 1]
remote:        [ERROR]
remote:        [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
remote:        [ERROR] Re-run Maven using the -X switch to enable full debug logging.
remote:        [ERROR]
remote:        [ERROR] For more information about the errors and possible solutions, please read the following articles:
remote:        [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
remote:
remote:  !     ERROR: Failed to build app with Maven
remote:        We're sorry this build is failing! If you can't find the issue in application code,
remote:        please submit a ticket so we can help: https://help.heroku.com/
remote:
remote:  !     Push rejected, failed to compile Java app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:

The error here specifies that my User and Post models file name starts with lowercase letters.

But my file structure is:

File Structure for the models

I do not think the error is in the Models, and I am not able to find out the issue.

shingo.nakanishi :

In your screenshot, the file name starts with a capital letter, but

remote:        [ERROR] /tmp/build_79201803/src/main/java/com/pukitbanta/springblog/model/post.java:[15,8] class Post is public, should be declared in a file named Post.java
remote:        [ERROR] /tmp/build_79201803/src/main/java/com/pukitbanta/springblog/model/user.java:[12,8] class User is public, should be declared in a file named User.java

the file name displayed in the error message is in lower case.

Please check again for lowercase letters. If they are in lowercase, please correct them as follows:

  • Rename post.java to Post.java
  • Rename user.java to User.java

If it doesn't make sense to rename those files, it's probably a problem with your Git settings.

see: https://stackoverflow.com/a/46670520/1979953

It WAS a case-sensitive issue. The problem is that I didn't know that GIT is not looking for case-sensitive changes in the file.

You can check your git configuration:

$ git config -l | grep ignorecase

The core.ignorecase is the one we need this time.

If core.ignorecase is true, Git will ignore case differences; if false, Git will recognize the difference. So you need to set false.

Then let Git recognize the changes and deploy them to Heroku again.

To update the core.ignorecase to either true or false run:

git config core.ignorecase true

or

git config core.ignorecase false.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

SQLSyntaxErrorException when deploying Spring Boot app to Heroku

Error with collectstatic while deploying Django app to Heroku

Heroku R10 Error while running Spring Boot App

Deploying Spring Boot App on Heroku - Build Success, but then: page could not be served

Deploying Spring boot App, to Heroku With Docker using github

Dependency installation failed! error while deploying laravel app to heroku

Deploying spring boot application to heroku - error message "No web processes running"

Error while deploying spring boot restfull api on tomcat external server

Deploying Go app to heroku error

deploying flask app to heroku error

Error with deploying springboot app to heroku

Error Deploying Spring Boot App using 2.6.2 on IBM Websphere 8.5.5.20

error while running spring boot app on localhost

Precompiling assets issue while deploying app to heroku

Getting error while deploying angular app to heroku and while running ng serve?

Unable to lock Dropbox error while deploying in Heroku

Flask API Crash Error while deploying to Heroku

Deploying Spring MVC web app on heroku

Failure when deploying Spring App to Heroku

Heroku getting at=error code=H10 while deploying python Flask web app

Outdated yarn lockfile error on deploying app on heroku

Deploying JS app on Heroku - error status 503

PostgreSQL error when deploying jhipster app on Heroku

Error when deploying Angular app to Heroku

Deploying a typescript app on heroku, execution error

`collectstatic` error when deploying Django app to heroku

Application error on Deploying MEAN app on Heroku

Error deploying app to Heroku with Tomcat and Mysql

Error deploying Rails 4 App to Heroku redis