This documentation is for WSO2 ESB version 4.0.3. View documentation for the latest release.

Installing Apache Maven for ESB on Windows

In order to build WSO2 ESB from the Source distribution, it is necessary to install Apache Maven on Windows.

Apache Maven v.2.1.0 or later is recommended for WSO2 ESB. To build the WSO2 ESB from its source distribution, you need Maven 2.2.0 or later

Note

See ESB Installation Prerequisites for the list of all applications necessary to install and work with WSO2 ESB, and links to them.

Follow the instructions below to set up Apache Maven.



Step 1. Check Java

Make sure you have a JDK installed on your system. See Apache Maven System Requirements for details.


Step 2. Download Apache Maven

1. Open a Web browser and access the following URL:

http://maven.apache.org

2. Apache Maven home page opens. In the left upper corner of the page, the "Get Maven" section, that contains download links, is situated . Click "Download."

3. The link redirects to the storage page of different download pack versions. Choose the version suitable for Windows.

4. The link redirects to the page suggesting a mirror site for the download. Follow the link on the page.

5. The download Save dialog box opens. Click "OK."

6. The download starts.


Step 3. Extract the Archive

After the download is complete, extract installation files to the user-defined folder. For example, c:\wso2\apache-maven-3.0.3.


Step 4. Set up M2_HOME

In order to run Apache Maven, it is necessary to set up M2_HOME environment variable, and add "bin" to PATH variable. The variable points to the directory where Apache Maven is installed on the computer.

Reference

Environment variables are global system variables accessible by all the processes running under the operating system.

Locating the Apache Maven Installation Folder

In order to set the variable, it is necessary to know the Maven installation folder. Using a browser (e.g. Total Commander) open the user-defined directory to which Apache Maven archive was extracted (See Step 2). This is the path to Apache Maven installation folder.

Setting M2_HOME

Follow the instructions below.

1. Right-click the "My Computer" icon on the desktop.

2. Click "Properties" in the displayed pop-up.

3. The "System Properties" window opens with its functional tabs. Go to the "Advanced" tab.

4. In the "Advanced" tab click "Environment Variables."

5. The "Environment variables" window opens. Click the "New" button under "System variables."

6. The "New system variable" input box opens. Type "variable name": M2_HOME, and "variable value": Maven installation directory.

For example, c:\wso2\apache-maven-3.0.3. Click "OK."

7. In the "System variables" field select "PATH" and click on the "Edit" button.

8. The the "Edit system variable" dialog opens. Add "<M2_HOME>\bin" without quotes to "Variable value", where "<M2_HOME>" is the Maven installation directory. For example, c:\wso2\apache-maven-3.0.3\bin. Click "OK."

9. Click "OK."

10. Apache Maven set up is complete successfully.

Make sure that the system variable JAVA_HOME is set to the JDK location.


Step 5. Verify Apache Maven Installation

Follow the instructions below to verify that Apache Maven is set up correctly.

1. Click "Start" "Run."

2. Enter "cmd" without quotes and click "OK" to access Windows command prompt (CMD).

3. In the opened CMD window, type the following command and press <Enter>:

mvn --version

4. Information on current version of Apache Maven and M2_HOME location is displayed.

*"System variables"* or *"User variables"*?

In case there is a need to set up variables for the user currently logged in only, JAVA_HOME should be set up in "User Variables" (the same way as in "System variables"). These changes will not affect any other users.

Notice

Variable set up will be effective for the CMD opened after this operation. In case a CMD had been run before the variable was set up, this change is not effective for it. To ensure the variable set up is effective, and variable value is reset, close and reopen the CMD you will run ESB from, or close and reopen the browser (e.g. Total commander) you are going to run the CMD from.

Once Apache Maven is properly set up, you can start building the WSO2 ESB from the source distribution.