In this tutorial I will share how to set up eclipse with your external maven installation. Assuming that you have the maven plugin already available in eclipse. As most of the developer usually sets up the maven by downloading from the apache project and sets them up manually than depending on eclipse , and sets a custom repo location.
But Eclipse being the one of preferred editor which also comes with an maven plug-in with an maven set up in-build with its own settings like maven repo location which could be different from the users repo location.
- Lets get started. From Eclipse menu Window->Preferences and then click on Maven on the left pane. ( Assuming that your eclipse bundled or explicitly installed plug-in: M2E - Maven Integration for Eclipse )
- Expand the Maven and locate "User Settings".
- Choose the User Settings ( settings.xml ) file. The maven plugin ( m2e ) usually has an maven inbuilt and as with maven default settings the local repository would be located in c:\users\<yourname>\.m2\settings.xml. Having this file changed to the settings.xml file which you would have been controlling through manual installation of Maven outside your eclipse. For my case I have installed my maven installation at F:\software\apache-maven-3.1.1\conf\settings.xml. So I would choose the file for User settings/Global settings, this file would contain the location of my custom repo relocation. You would also notice as the file is chosen the Local repository also changes to F:/repo , which my is defined in my F:\software\apache-maven-3.1.1\conf\settings.xml file.
- Now you are done, just click "ok" to save the changes.