Search code examples
eclipsemavenm2e

Adding dependency from local repository - m2e


I am using eclipse with m2e plugin and I have in my home folder my local repository. m2e sees it because when I go to

Window->Show View->Maven->Maven Repositories

I can see my local repo, but when I try to add dependency to my project I need to manually write group-id and artefact-id. Surely there must be a way to add dependency through some menu which lists jars in the repository.


Solution

  • Easy to do, two ways:

    • Double click the POM file so that it opens in the Maven POM Editor. The Dependencies tab will allow you to add the dependency with search capabilities.
    • You can do the same by right-clicking the project, then Maven > Add Dependency

    The Add Dependency dialog has a Search field which allows you to start typing and will show matching artifacts. Start typing spring, and it will show you everything Spring-related. You can then pick the desired artifact and version from the list of results and it will be added to your POM file.