
Apache Maven is a Software Project Management tool. Based on the concept of a Project Object Model (POM
), Maven can manage a project’s build, reporting and documentation from a central piece of information.
On Crunchify, we do have more than ~20 different maven tutorials
including Setting up Maven Classpath on Windows and MacOS, maven-war-plugin, maven-shade-plugin, maven-assembly-plugin, etc.
In this tutorial we will go over highly and widely used some tips and tricks
which will fix most of the Maven and POM dependency related issues for your in Eclipse IDE.
Below tips will work if you have any of below questions:
- In Java how to fix Maven, Maven Configuration and Maven Dependency issue?
- How do I update my Maven project to work in Eclipse?
- maven dependency problem in eclipse
- maven dependency problem eclipse missing artifact
- How to fix error “Updating Maven Project”?
- Maven Common Problems And Solutions
Let’s get started:
Task-1: Perform “Project Clean” in Eclipse IDE
Step-1
Create new
maven based project oropen existing
maven project.- In my case, I’m opening my existing Simplest Spring MVC Hello World Project in Eclipse.
Step-2
- Click on
Project
Menu item in Eclipse - Choose
Clean...
option from list

Step-3
- Select a
project
which you want to clean or Select All - In my case it’s just CrunchifySpringMVCTutorial

Task-2: Perform Maven Update Project in Eclipse IDE
Step-4
- Right click on Project
- Click on
Maven
- Click on
Update Project...

Task-3: Perform Maven clean install in Eclipse IDE
Step-5
- Right click on project
- Click on
Run As
- Click on
Maven build...

Step-6
- Provide Goal:
mvn clean install
- Select checkbox for
Skip Tests
- Click
Apply
andRun

You should see BUILD SUCCESS
message after successful run.

By performing above steps most of the common
Maven build issues should be resolved in Eclipse. Let me know if you face any more issues and will try to debug.
Last Option:
Nothing worked and you are still getting
weird Maven issue
? Try deleting.m2/repository folder via File Explorer
.-> After that perform above steps and all maven libraries will be downloaded again fresh.
Hi Sir,
When I import existing maven project(simple spring MVC project) I am getting “Cannot access defaults field of Properties” in order to avoid this i added maven war plugin 3.3.1 in pom.xml it got solved and I tried maven clean install in eclipse the build got failed… I am using STS 4 with jdk 17… Could you help me with this one
HI, App Shah. I can use clean install successfully but I can’t use mvn clean install. And I had already tried to delete the things in .m2/repository. And this is my problem. Th https://uploads.disquscdn.com/images/df6e972149fddb5c7f2a7474a986bf95a245995db99f87ff9f44515b0b11462b.jpg ank you!!!
HI, I have error with build failure, below is that
Hi Lavanya – this seems like an issue with mvn command.
Could you please try without MVN? i.e.
clean install
instead ofmvn clean install
?I got this type of error when try to build the project.
Hi Sagar – could you please help share a screenshot of an error? It looks like you have just provided JRE as your classpath and not JDK.
Make sure to add JDK to your class path and retry.
Hope this helps.
Thanks – this post saved me a lot of problems after an mvn clean led to class not found errors.
You are welcome Jason. Happy to help. Happy coding and keep visiting.
Thanks a lot. after a long search and debug. this worked
Aaaha! Happy to help Chaitanya. Thanks for your feedback and comment.
hi sir, build is successfull but still i am getting error in pom.xml, i also deleted m2/reposiotry from file explorer,
Hi Abinash – after build success message, please try refreshing your project. Error in pom.xml may be just a temporary issue.
I am facing a problem while createing a maven project it take too long time and show somethimg dowloading but it look like stoped at point what i do
https://uploads.disquscdn.com/images/c543acf2dba26f99784ff4ee1ef0ef1190a349a2833d321f91f4f0ea42a14941.png
Hi Abinash – please see my comment here: http://disq.us/p/2a9lb6w
Hey Hi still I am getting this error after following your steps can help me to relove this?
Sorry to hear that Mallu Manish Shetty. Do you have Maven installed and is it in classpath?
Also one more thing. This seems like an issue with maven settings.xml file.
Could you please share file content?
APPLICATION FAILED TO START
***************************
what is the solution for this??
Shanti – Also try deleting your maven repository location. Building project will auto download all new dependencies.
Path: /Users//.m2/repository
You can find more details about setting.xml file and repository location here.
Hi Shanti – can you please try running maven clean install again?
Hope you have this dependency in your pom.xml:
Usually this error caused by Maven downloading a corrupt version of the jar. Deleting it to force a new download fixed the issue.
Nice Blog. Thanks for sharing such a nice details..
You are welcome Aveesha. Happy coding and keep visiting.
Hi I am facing error while I am trying to clean my maven project
Hi Divya – could you give me complete stack trace or exception message? Which error are you referring?
Getting this error:
Seems like an issue with Maven.
mvn
is not available for you to use. Try – usingmaven
instead.-X clean install try this one
Try checking command one more time. As mentioned by Balu – try adding
-X option
.Unknown lifecycle phase “mvn”. You must specify a valid lifecycle phase or a goal in the format : or :[:]:. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
Hi David – try removing mvn. Just use “clean install” and let me know if that works.
Unknown lifecycle phase “mvn”. You must specify a valid lifecycle phase or a goal in the format : or :[:]:. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
Hi Asif – try using clean install