mydomain
No ADS
No ADS

Install Maven for Eclipse

  1. Introduction
  2. Check your Eclipse in order to see whether it installs Maven or not.
  3. Install Maven into Eclipse as Embed Program
  4. Install Independently Maven outside Eclipse

1. Introduction

No ADS
This document is based on:
  • Eclipse 4.5 MARS (or newer)

The objective of the document:

I will show you two ways to interact with Maven and Eclipse:
  • Method 1: Install Maven as embed program into Eclipse.
  • Method 2: Install Maven independently on Windows and declare it so that Eclipse can use it.
After you've installed Maven, you can read document using Maven for beginners:

2. Check your Eclipse in order to see whether it installs Maven or not.

No ADS
First of all, check your Eclipse in order to see whether it installs Maven or not.
  • File/New/Other..
If Maven Wizard exists, it means your Eclipse has been installed with Maven Plugin, and it is ready to work. However, you still can re-install its latest version if you want.

3. Install Maven into Eclipse as Embed Program

No ADS
Enter:
  • Name: m2e
  • Location: http://download.eclipse.org/technology/m2e/releases
You have successfully installed Maven into Eclipse, restart Eclipse.

4. Install Independently Maven outside Eclipse

No ADS
Download Maven
This document is based on the latest 3.3.3 Maven version, so we are going to download and use this version.
After the Maven is downloaded completely, you can extract and save the zip file on a specific folder of the hard drive.
You can see an example as below:
  • D:/DevPrograms/apache-maven.3.3.3
This is an extracting result on hard drive
Setup Environment variables
The next step is declaration an environmental variable to maven. These pictures as below are based on Windows 7, and the other Windows operating systems are similar.
They are included the environmental variable and declared to Path
  • JAVA_HOME=C:\DevPrograms\Java\jdk1.8.0_40
  • M2_HOME=D:\DevPrograms\apache-maven-3.3.3
  • M2=%M2_HOME%\bin
  • Path=;%M2%;%JAVA_HOME%\bin
Please check to make sure that you do not declare the JAVA_HOME environmental variable, then add it.
Similarly, you can declare to two other environmental variables.
Finally, append to the value of the Path environmental variable as below :
  • ;%M2%;%JAVA_HOME%\bin
Next, check your environmental declarations. You'd better restart or "log off" your computer.
Open a command window and type the command:
  • mvn --version
Declare setup location Maven on Eclipse
Open a folder:
  • D:\DevPrograms\apache-maven-3.3.3\conf
Open the settings.xml file to change some parameters.
Then add:
  • <localRepository>D:\DevPrograms\apache-maven-3.3.3\repository</localRepository>
Open Window/Reference on Eclipse.
Click "Add" to add a new profile.
Next, declare the position of the Maven configuration file which was changed last time .
The Maven installation into Eclipse is completed.
No ADS
No ADS