NetBeans IDE maven project unable to solve depende

2019-09-02 17:53发布

问题:

After using eclipse for ages I am porting myself to NetBeans IDE. I am opening my existing maven project and all seems ok, but when I am trying to build the project it is throwing error saying "Could not resolve dependencies for project" though the JAR files are present in my .m2 directory.

I am using a ubuntu 12.10 and netbeans version 7.3.1

Any suggestions on the same are highly appreciated.

回答1:

"Any suggestions on the same are highly appreciated."

This may not solve your current problem, but is a suggestion for the future, or even if you want to do it for your current projects.

First thing is you need to make sure your project was imported correctly as a maven project. As you can see in the image, all maven projects, have a little m in the top left of the project logo. The first project is a maven web app, the second a regular maven app, and the last a regular java app. If you see your projects as maven apps, then all you need to do is right-click on the Dependencies and select add dependeny. You can search your local repo from the dialog that opens. The once you select will get automatically inserted into you pom, and you will see teh jar in the Dependencies folder.

If you don't see the depencies folder, then your projects were not imported as maven projects.



回答2:

I had different situation.
My .m2 folder was a bit large, so I decided to delete it.
When I opened one Vaadin project I was working on which consists of regular modules, almost all dependencies was resolved. I'm saying almost because, one module which is dependent on the other independent maven library project could not resolve three dependencies at all!
After a while, I opened that independent library module and rebuilt it. As soon as I started, I noticed missing dependencies started to download and the problem was resolved immediately !
Hope this experience will help.