I've looked this up extensively and found no useful answer. I'm trying to deploy this API with Heroku. It's a pre-existing GitHub repository, I followed Heroku's devcenter guidelines. I tried to deploy via Git and the Heroku Maven Plugin, and the result is the same: I can build it locally and everything is fine, but when I cd to ~/workspace/API/myapi/
and try to push it to Heroku doing git push heroku main:main
I get:
Enumerating objects: 237, done.
Counting objects: 100% (237/237), done.
Delta compression using up to 4 threads
Compressing objects: 100% (179/179), done.
Writing objects: 100% (237/237), 91.06 KiB | 4.14 MiB/s, done.
Total 237 (delta 61), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Java app detected
remote: -----> Installing JDK 11... done
remote: -----> Executing Maven
remote: $ ./mvnw -DskipTests clean dependency:list install
remote: ./mvnw: 219: ./mvnw: cannot open /tmp/build_f4dfb6d1/API/myapi/.mvn/wrapper/maven-wrapper.properties: No such file
remote: /tmp/build_f4dfb6d1/API/myapi/.mvn/wrapper/maven-wrapper.jar: No such file or directory
remote: Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
remote: Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain
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:
remote: ! Push rejected to myapiheroku.
remote:
To https://git.heroku.com/cashonlineheroku.git
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/myapiheroku.git'
/home/myuser/workspace/API/myapi/.mvn/wrapper/
contains the files maven-wrapper.jar
, maven-wrapper.properties
and MavenWrapperDownloader.java
. /home/myuser/workspace/API/myapi/system.properties
specifies java.runtime.version=11
. /home/myuser/.m2/repository/ar/com/api/myapi/
contains myapi.0.0.1-SNAPSHOT.jar
. pom.xml
, application.properties
, etc in the repository linked above.What am I missing? Let me know if you need additional information. Thanks in advance!
It looks like you have a mvnw
file in the root of your project directory but are missing other files required by Maven wrapper. Those usually reside in the .mvn/wrapper
directory of your application. You might have deleted them.
You have two options:
mvnw
and mvnw.cmd
mvn -N io.takari:maven:0.7.7:wrapper
I'd go for option 2. Using the wrapper is generally preferred to ensure your project is run with the Maven version you expect.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.