Skip to content

Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain – How to fix?

When you are using maven as a build tool in your Spring Boot project you will get this error if there is no Maven wrapper found inside the root directory of your project. You would have forgotten to commit it in your repository.

./mvnw: line 276: /home/john/poopcode-spring-batch-batch/.mvn/wrapper/maven-wrapper.properties: No such file or directory
/home/john/poopcode-spring-batch-batch/.mvn/wrapper/maven-wrapper.jar: No such file or directory
Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain

To generate the maven wrapper files inside your root directory of your project , run the following command.

mvn -N io.takari:maven:wrapper
[INFO] Maven Wrapper version 0.5.6 has been successfully set up for your project.
[INFO] Using Apache Maven: 3.6.3
[INFO] Repo URL in properties file: https://repo.maven.apache.org/maven2

See also  How to increment date by one day in Java?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.