In addition to the core ONOS system and applications, the ONOS project has created sample applications ("ONOS Sample Apps") which provide additional features and can also serve as instructional code or as something that you can extend and modify into a full-featured application.
Before building the ONOS Sample Apps, you should make sure that you have installed Java,
git, and Maven.
Maven vs. Buck
Beware: ONOS and the core applications in the main ONOS source tree are currently built using
buck, but the sample apps in
onos-app-samples are currently built using
mvn. This may change in the future! It is likely that we will move to a single build system for both ONOS and all of its applications.
Fetching the Source Code
Selecting the ONOS Version
By default, the sample apps will be built against a nightly snapshot of ONOS master. The functionality and reliability of this snapshot may vary rapidly and unpredictably, but it may also be what you want if an application requires bleeding-edge features.
If you wish to build against a released version of ONOS rather than a random snapshot, you can edit pom.xml to specify a specific ONOS release. For example:
To simply compile and check for errors, you can
cd to the
onos-app-samples directory and run:
This will download all of the required
.jar files, including ONOS as well as other required libraries, and compile the Java source into
It will produce a lot of output, but should eventually succeed, printing something like:
To compile each app all the way from Java into an
.oar (ONOS app archive) file which can be installed into ONOS, you can run
This will produce similar output to that produced by mvn compile, but will take slightly longer since it is creating the
.oar files as well.
.oar files are suitable for installation into the appropriate version of ONOS that you specified in
mvn install doesn't actually install the package into ONOS! Rather you need to follow the appropriate instructions for installing and activating the app into your own ONOS system.
Application installation and activation is discussed in Managing ONOS applications.