reset password
Author Message
cysun
Posts: 2935
Posted 11:23 Apr 07, 2014 |

1. Corrupted Dependency

Maven automatically downloads the project dependencies and saves them in a local folder ${USER}/.m2 - on Windows 7 it should be C:\Users\<username>\.m2.

If the downloading was interrupted, some files may be corrupted, and currently Maven is not smart enough to re-download those files. You can force Maven to download those files again by simply deleting those dependencies from the .m2 folder. If you know which dependency is causing problems, delete only that dependency so you don't have to re-download everything. For example, if you got a message that says "cannot load Maven plugin org.apache.maven.plugins.maven-compiler-plugin", just delete the folder ${USER}/.m2/repository/org/apache/maven/plugins/maven-compiler-plugin (note that the directory corresponds to the package name), then try the operation that caused the error again.

2. Incomplete Repository Index

Another common problem is that when you try to search for some dependency in Eclipse, nothing comes up. This is because Maven builds a local searchable index of the dependencies hosted on a remote repository. If index building is interrupted, dependency search won't work. To rebuild the index, open the Maven Repositories view (Window -> Show View -> Other -> Maven Repositories), right click on central under Global Repositories, and select Rebuild Index. Rebuilding index can take a very long time so be patient. You can check the progress in the Progress view. And you may want to check Download repository index updates on startup in Preferences so the index is kept up-to-date.

Last edited by cysun at 13:57 Apr 07, 2014.