How To Import Maven Project From OpendayLight Git Repository To Eclipse

This is a step by step guide to import maven project from OpendayLight Git Repository to Eclipse.

Step 1: Download and install Git.


Step 2: Clone an existing Git Repository

This can be done either using Git Bash or Git GUI. I used Git GUI to clone the controller and yangtools repositories.  For these use the source locations as & respectively.

Step 3: Download & install Maven


Step 4: Set MAVEN_OPTS – below instructions are for windows:

  1. Open “System -> Advanced system settings -> Environment Variables”.
  2. Under System variables click New…
  3. Enter Variable name: MAVEN_OPTS, Variable Value: -Xmx768m -XX:MaxPermSize=512m
  4. Click OK to add.

Step 5: Build OpendayLight controller code from command-line.

  1. Open command line prompt at the <git>/<odl controller> directory.
  2. Run “mvn clean install” from the command prompt.
  3. If build fails try to run “mvn clean install” on <git>/<yangtools> directory and then re-run “mvn clean install” on odl controller.
  4. If you get PermGen space errors, refer Troubleshooting.

Step 6: Download Eclipse


Step 7: Download and install JDK 1.7


Update JAVA_HOME and Path environment variables to point to JDK 1.7.

Step 8: Edit eclipse.ini to run Eclipse with JDK 1.7

Just before the line that says “-vmargs”, insert (on two separate lines)
C:\jdk1.7.0_51\bin\javaw.exe  (location points to where jdk is installed)

Step 9: Ensure that selected JRE in Eclipse is JRE 1.7

Go to Window -> Preferences -> Java -> Installed JREs & verify. If JRE 1.7 is not selected, then Click on Add… -> Standard VM. In “JRE home” field, browse to the directory where the JDK is installed. Click on “Add External JARs”, select the file “tools.jar” from the <jdk>/lib directory and click Finish.

Step 10: Install Maven Integration for Eclipse Plugin

  1. In Eclipse, Help -> Install new Software…
  2. In “Work with” filed enter and click Add…
  3. Select Maven Integration For Eclipse and install it.

Step 11: Import the Maven Projects in Eclipse

  1. In Eclipse, go to File -> Import… -> Maven -> Existing Maven Projects.
  2. Root Directory: Select the <git>/<odl controller> directory.
  3. It may ask you to install additional plugins. Let it go through.
  4. Importing of opendaylight controller may take some time.

Leave a Reply

Your email address will not be published. Required fields are marked *