How to fix Maven, Maven Configuration and Maven Dependency Problems in Eclipse

76.6k views Asked by At

Edit: I have not resolved this problem yet but this post could be really useful in this kind of problems:

How to fix your Maven problems


I did svn checkout of my maven project to directory MainDirectory. Everything went well.

Next, I went to MainDirectory and I run command

mvn clean package

with BUILD SUCCESS

I went to directory of my project MainDirectory/MyProject and I run the same command, once again it worked well.

I run Eclipse and I wanted to import "Existing Maven Projects". I chose MainDirectory as RootDirectory and I got a warning:

Warning

I clicked next and I saw few errors:

Errors

Anyhow, I clicked finish (because of Action: Resolve Later)

I was waiting few seconds and I saw this error:

Error2

but my projects are visible in Project Explorer.

I was carrying on. I imported second "Existing Maven Projects" - MainDirectory/MyProject. This time, I had no warning. I clicked next and errors appeared:

Error3

I clicked finish and another error appeared:

Error4

Anyhow, new project exists now in Project Explorer.

I went to Project->Clean and I chose all my projects. Once again I got an error:

Error5

Finally, I tried Maven->Update Project and another error appeared:

Error6

I was trying to clean somehow my local repo but I am not sure if I did it correctly.

Finally in Eclipse I see errors as below:

enter image description here

In fact, I have already done this procedure once few days ago and everything worked perfectly.

When I run my application:

mvn jetty:run

It works perfectly.

Thank you in advance

4

There are 4 answers

0
AudioBubble On BEST ANSWER

I have already got this problem, please make sure that the configuration file path of maven is correctly set in your eclipse ? If you install maven by yourself it is setting with a default path which might not be the same as yours.

Check the following screen to check if you have the good settings, to go here just go to window->preference and type maven in the type filter :

Maven Setting

0
djmorton On

Another Stackoverflow user was having a similar problem and there are several things to try listed as answers to that question. Do any of the workarounds outlined on that question help you?

Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved

0
Pratik Kasalkar On

I had the same issue. I changed the apache maven plugin version in pom.xml to the version used by the web-app in web.xml. Then Maven > Update Project.

Note: The jdk/jre should be compatible to plugins you are using.

0
Mithun Khatri On

There may be following solutions-

  1. Convert project into maven project(if maven nature is not there in project configuration)
  2. Check Maven Dependency Library in Build Path. None of the dependency should throw error.

If problem still persist then-

  1. Open terminal, goto the project folder where pom.xml is present and run mvn eclipse:eclipse command in terminal and refresh the project in eclipse.

  2. run mvn clean install to install jar in local repo(.m2) (run mvn clean install -Dmaven.test.skip=true if you want to skip test cases.)

It should definitely work.