This is a step by step guide to import maven project from OpendayLight Git Repository to Eclipse.
Step 1: Download and install Git.
Refer http://git-scm.com/book/en/Getting-Started-Installing-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 https://git.opendaylight.org/gerrit/p/controller.git & https://git.opendaylight.org/gerrit/p/yangtools.git respectively.
Step 3: Download & install Maven
Refer http://maven.apache.org/download.cgi
Step 4: Set MAVEN_OPTS – below instructions are for windows:
- Open “System -> Advanced system settings -> Environment Variables”.
- Under System variables click New…
- Enter Variable name: MAVEN_OPTS, Variable Value: -Xmx768m -XX:MaxPermSize=512m
- Click OK to add.
Step 5: Build OpendayLight controller code from command-line.
- Open command line prompt at the <git>/<odl controller> directory.
- Run “mvn clean install” from the command prompt.
- If build fails try to run “mvn clean install” on <git>/<yangtools> directory and then re-run “mvn clean install” on odl controller.
- If you get PermGen space errors, refer Troubleshooting.
Step 6: Download Eclipse
Refer http://www.eclipse.org/downloads/
Step 7: Download and install JDK 1.7
Refer http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
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)
-vm
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
- In Eclipse, Help -> Install new Software…
- In “Work with” filed enter http://download.eclipse.org/technology/m2e/releases and click Add…
- Select Maven Integration For Eclipse and install it.
Step 11: Import the Maven Projects in Eclipse
- In Eclipse, go to File -> Import… -> Maven -> Existing Maven Projects.
- Root Directory: Select the <git>/<odl controller> directory.
- It may ask you to install additional plugins. Let it go through.
- Importing of opendaylight controller may take some time.
Leave a Reply