Get the source code
To get the code, you will need the git application and the git address for the code. We recommend you to follow this guide in github. The guide also includes how to get the git tool installed in your system.
Once git is configured in your system, you can get the source code. OpenNaaS code is available as a github repository at:
https://github.com/dana-i2cat/opennaas
To download the code, just run the following command.
git clone https://github.com/dana-i2cat/opennaas.git
Releases
By default, git will clone the master branch only. This branch contains the latest stable release of OpenNaaS. You can get the development branch (highly unstable), which is named "develop". Alternatively, you can stick to a given release from master.
Master contains the latest release, and older releases are tagged so you can get the release from the tag, by launching the following git command:
git checkout <tag_name>
So, in order to fetch the development version (you should always do this if you plan to contribute code) you need to:
git checkout develop
Build requirements
OpenNaaS is build using Maven and Java. You will need:
- Java SDK 1.6. http://www.oracle.com/technetwork/java/javase/downloads/index.html
- Apache-maven 3.* http://maven.apache.org/download.html
Maven is available for most of platforms. You only need to decompress the project in a folder and configure your terminal by setting of the path variable. Different binary releases will be published in the web. However, any version of the source code can be downloaded from the code repository.
For any Java installation you might need to set JAVA_HOME in your environment properties.
Also you will need Netconf4j if you are willing to develop OpenNaaS. It's a spin-off of Manticore 2 and Mantychore projects that serves as a netconf client but also provides mock transport that is used in OpenNaaS tests. Feel free to get it and play with it. If you only need to build opennaas, maven will fetch it for you.
git clone https://github.com/dana-i2cat/netconf4j cd netconf4j/ mvn clean install
Build the project
Once you've installed all required software, and also downloaded OpenNaaS source code, you can start the building process . Go to OpenNaaS directory and execute the next command.
mvn clean install
This will cause maven to download all required dependencies, install them to your local repository and build our application.
Populating your local repository with all required dependencies may take its time, especially the first time you do it.
Upgrade your code
To upgrade your code to the last released version (last version in master, in this case), you can use pull command from master (or any other branch):
git checkout master git pull git://github.com/dana-i2cat/opennaas.git master mvn clean mvn install
Tips and tricks
Skip Tests
If you want to build the project but skip the tests, you can do so using
mvn clean install -DskipTests
Given flag will cause maven not to run tests, but tests will be compiled anyway.
For skipping test compilation too, use:
mvn clean install -Dmaven.test.skip=true
Resume from a given point
If you want to build artifacts starting in a specific one (useful after fixing an error in that artifact), use:
mvn clean install -rf :<artifactId>
Do not stop at first failure
Maven stops building the project when a tests suite fails. To force maven to keep on building and testing use the "fail never" flag:
mvn clean install -fn
At the end of the building process, a summary of the execution will show you per artifact results.
Adding memory to maven
Depending on your system specifications, you may need to increase the amount of memory maven can use to compile the project.
Typical related errors are:
- Java heap space
- PermGen space
Apache Maven project has this web that may help to solve the problem.
In short:
MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=128m" mvn install -DskipTests