Date: Fri, 29 Mar 2024 01:19:09 +0000 (UTC) Message-ID: <1283127374.949.1711675149597@ip-10-30-146-46.us-west-2.compute.internal> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_948_1096909283.1711675149594" ------=_Part_948_1096909283.1711675149594 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
This page is out of date and applied to releases before 1.14 - for up to= date instructions see Using an IDE with ONOS 1.14 or higher (Bazel build)
The Youtube Video has been removed
In this screencast we will show you how easy it is to import ONOS code i= nto the IntelliJ IDE. This demonstration assumes that the ONOS code has alr= eady been checked out and preferably also built using the onos-build command.
To import the ONOS project, simply open IntelliJ IDEA and select: Fi= le=E2=80=A6 New=E2=80=A6 Project from Existing Sources
If you are starting IDEA for the very first time and don=E2=80=99t have = any existing projects, you can alternatively select: Import Project=E2= =80=A6 from the initial options.
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.
On the first screen we only need to check Sources and Documentation and = then press Next.
Select Next to bypass the Maven profiles.
Make sure that the org.onosproject:onos Maven project is select= ed and press Next.
After this select the JDK 8. If selecting JDK for the very first time, y= ou may need to press the + sign to locate the JDK home directory. Press Next and then Finish.
At this point IntelliJ will complete the import process by building the = project and indexing the source files.
While the project is being processed, we can go ahead and import the rec= ommended IDEA settings. We do this by selecting File=E2=80=A6 Import Se= ttings=E2=80=A6 and then navigating to the ONOS tools/dev dir= ectory and selecting the idea-settings.jar file. We can complete t= he process by pressing the OK button.
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 f= ile.
To configure IntelliJ appropriately, we will locate the header.txt= em> file under ONOS tools/dev directory and copy its contents. The= n, from IntelliJ preferences, we will select Copyright section and add a ne= w new copyright profile. We will call this profile ONOS and paste in the pr= eviously copied header text.
Then we will make sure that the newly created ONOS copyright profile is = the default and we are done.
At this point, the ONOS project should be fully processed and we are fre= e to navigate and search the codebase.
Pressing Command-N or d= ouble-tapping the Shift key, we can bring up the search window whe= re we can type our search term.
Let=E2=80=99s search for = Device. When the Device.java file is open, we can see that= it is an interface. Clicking on the down-arrow next to the interface decla= ration will open the list of implementations. We will select DefaultDev= ice to open this particular implementation source.
Right clicking on the DefaultDevice implementation we can select various options, including = Diagrams... where we can select Show Diagram=E2=80=A6 to = reveal the UML of the class hierarchy for the DefaultDevice class.=
Most IDEs allow developers to execute unit tests directly from the work-= bench. IntelliJ is among them. There are many different ways to do this. Fo= r example, right-clicking on a section of the source tree, will execute all= unit tests contained within.
This was just a quick overview of how to import the ONOS source code int= o the IntelliJ IDE. I hope you found this useful and I look forward to seei= ng your contributions to the codebase.
Have a great day=E2=80=A6 and ha= ppy coding!