Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info
titleNeeds update

This section needs to be updated for the latest version of ONOS, which is built using buck rather than mavenpage is kept here if you need to work on an older version of ONOS that used Maven.

Starting from ONOS 1.14 we use Bazel to build and to import the project in the IntelliJ IDE

IDE Setup

The project does not enforce the use of a specific IDE, but rather, a set of guidelines that can be configured in an IDE. The examples and documentation focus on IntelliJ IDEA, and include some help for Eclipse. For other IDEs, developers should consult the documentation for the IDE of choice for specific configuration steps. 

...

If you have no idea where to start, here are some instructions on how to install IntelliJ. The ONOS Screencasts page provides helpful videos on importing, debugging, and developing ONOS with IntelliJ.

...

A helpful screencast illustrating the entire import process can be found here (the link to the video is at the top of the page). Assuming you have obtained the source code already, the following steps can be followed to import ONOS into IntelliJ: 

  1. To import the ONOS project, simply open IntelliJ IDEA and select: File… New… Project from Existing Sources
  2. If you are starting IDEA for the very first time and don’t have any existing projects, you can alternatively select: Import Project… from the initial options.
  3. When presented with a file selection dialog, you should navigate to the top of the ONOS source tree and select the root pom.xml file. This will initiate the project import wizard.
  4. On the first screen we only need to check Sources and Documentation and then press Next.
  5. Select Next to bypass the Maven profiles.
  6. Make sure that the org.onosproject:onos Maven project is selected and press Next.
  7. After this select the JDK 8. If selecting JDK for the very first time, you may need to press the + sign to locate the JDK home directory. Press Next and then Finish.
  8. At this point IntelliJ will complete the import process by building the project and indexing the source files.

Importing the settings

While the project is being processed, we can go ahead and import the recommended IDEA settings. We do this by selecting File… Import Settings… and then navigating to the ONOStools/dev directory and selecting the idea-settings.jar file. We can complete the process by pressing the OK button.

...

If IntelliJ is throwing errors like "The package 'org.onosproject.cluster' is not exported by the bundle dependencies," go to IntelliJ IDEA->Preferences. On the sidebar, under the Editor dropdown section, select Inspections. From there, search OSGi and under the OSGi dropdown, uncheck Package accessibility inspections and press OK.

Importing the Copyright header

Since ONOS is licensed under Apache 2 license, we need to make sure that all source files are properly decorated with the Apache 2 license header file.

...

Then we will make sure that the newly created ONOS copyright profile is the default and we are done. 


Info

As ONOS is a multi-module project, it may appear as a collection of many (about 50 at the time of this writing) projects beginning with "onos-". This is normal for some IDEs such as Eclipse.

For a listing of the software modules that comprise ONOS, please refer to the Javadocs, or Appendix C of this Guide.

...