運維除錯記錄:Opendaylight鈹版本開發環境搭建流程
一、系統環境
Ubuntu 14.04 LTS
CPU:雙核
記憶體:4GB
二、步驟詳解
1. 安裝JAVA開發環境
OpenDaylight requires Java 7 JDK for Lithium . For Beryllium, a Java 8 JDK may be required.
過程:
Ubuntu 14.04的軟體源中暫不支援java 8,因此,首先解決該問題:
- 對於Oracle JDK:
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer
- 對於Open JDK:
$ sudo add-apt-repository ppa:openjdk-r/ppa
$ sudo apt-get update
$ sudo apt-get install openjdk-8-jdk
- 檢測是否安裝成功:
zjl@zjl-uestc:~$ java -version
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)
zjl@zjl-kb310:~$ java -version
openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-0ubuntu4~14.04-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)
2. 安裝maven 3
Ubuntu預設支援的maven版本太低,因此,這裡選擇安裝maven 3.3.9版本。
- 清除之前安裝的maven:
$ sudo apt-get purge -y maven
- 轉入下載目錄:
$ cd ~/Downloads
- 下載maven-3.3.9(使用清華大學的源):
$ sudo wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
- 解壓安裝maven-3.3.9:
$ tar -zxvf apache-maven-3.3.9-bin.tar.gz
$ sudo cp -r apache-maven-3.3.9 /usr/local
$ sudo ln -s /usr/local/apache-maven-3.3.9/bin/mvn /usr/bin/mvn
- 配置環境變數:
$ echo "export M2_HOME=/usr/local/apache-maven-3.3.9" >> ~/.profile
$ source ~/.profile
- 測試是否安裝成功:
zjl@zjl-kb310:/usr/local$ mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /usr/local/apache-maven-3.3.9
Java version: 1.8.0_91, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.2.0-27-generic", arch: "amd64", family: "unix"
- 可選:提高Maven可用RAM總量的方法:
一些OpenDaylight專案可能十分大,其耗費資源也會很大,因此,可以增加Maven的可用RAM。
具體方法如下:
$ echo " export MAVEN_OPTS='-Xmx1048m -XX:MaxPermSize=512m' " >> ~/.bashrc
$ source ~/.bashrc
3. 安裝Git
略。。。
4. 修改~/.m2/settings.xml
OpenDaylight maintains its own repositories outside of Maven Central, which means maven cannot resolve OpenDaylight artifacts by default. Since OpenDaylight is organized as multiple inter-dependent projects, building a particular project usually means pulling in some artifacts. In order to make this work, your maven installation needs to know the location of OpenDaylight repositories and has to taught to use them.
具體方法:
# Shortcut command for grabbing settings.xml
$ cp -n ~/.m2/settings.xml{,.orig} ; \
wget -q -O - https://raw.githubusercontent.com/opendaylight/odlparent/master/settings.xml > ~/.m2/settings.xml
~/.m2/settings.xml的內容如下:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>opendaylight-release</id>
<repositories>
<repository>
<id>opendaylight-mirror</id>
<name>opendaylight-mirror</name>
<url>https://nexus.opendaylight.org/content/repositories/public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>opendaylight-mirror</id>
<name>opendaylight-mirror</name>
<url>https://nexus.opendaylight.org/content/repositories/public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
<profile>
<id>opendaylight-snapshots</id>
<repositories>
<repository>
<id>opendaylight-snapshot</id>
<name>opendaylight-snapshot</name>
<url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>opendaylight-snapshot</id>
<name>opendaylight-snapshot</name>
<url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>opendaylight-release</activeProfile>
<activeProfile>opendaylight-snapshots</activeProfile>
</activeProfiles>
</settings>
如果你使用了代理,那麼需要配置代理,具體閱讀:Maven proxy configuration。
錯誤處理:
如果遇到了如下錯誤:
[WARNING] Error initializing: org.codehaus.plexus.velocity.DefaultVelocityComponent
java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
新增下面內容到檔案~/.m2/repository/org/apache/maven/plugins/maven-archetype-plugin/{version}/maven-archetype-plugin-{version}.pom
:
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
相關文章
- MAC環境下PHP開發除錯環境搭建MacPHP除錯
- step 1 :搭建開發除錯環境除錯
- Flutter開發環境搭建和除錯Flutter開發環境除錯
- 運維除錯記錄:Ubuntu14.04下部署Opendaylight Nitrogen叢集運維除錯Ubuntu
- 搭建rust開發環境-記錄Rust開發環境
- 微信開發的本地除錯環境搭建除錯
- Linux下搭建FFmpeg開發除錯環境Linux除錯
- 【記錄】WSL 下搭建前端開發環境前端開發環境
- FLEX - 開發環境:除錯Flex開發環境除錯
- PHP開發除錯環境建立PHP除錯
- iOS開發之runtime(一):runtime除錯環境搭建iOS除錯
- Linux運維centos7中的jdk開發環境搭建Linux運維CentOSJDK開發環境
- [記錄] 很久不用的 Mac OS X 開發環境搭建Mac開發環境
- Laravel 開發環境搭建-筆記Laravel開發環境筆記
- vs搭建遠端除錯環境除錯
- windbg 搭建雙擊除錯環境除錯
- Redis原始碼漂流記(二)-搭建Redis除錯環境Redis原始碼除錯
- 搭建Go開發及除錯環境(LiteIDE + GoClipse) -- Windows篇Go除錯IDEWindows
- 前端開發環境(開發,除錯,測試工具)前端開發環境除錯
- 搭建golang開發環境(1.14之後版本)Golang開發環境
- Python筆記 開發環境搭建Python筆記開發環境
- risc-v環境搭建及除錯除錯
- macOS 下搭建 Go 語言開發環境-Go 學習記錄MacGo開發環境
- MAC上Flutter環境搭建記錄MacFlutter
- ODOO二開—windows開發環境搭建(13版本)OdooWindows開發環境
- 使用ansible搭建python多版本開發環境Python開發環境
- [php]手動搭建php開發環境(排錯)PHP開發環境
- 筆記-Flutter開發環境搭建Mac版筆記Flutter開發環境Mac
- perl學習筆記--搭建開發環境筆記開發環境
- RocketMQ系列-搭建Namesrv原始碼除錯環境MQ原始碼除錯
- 1 – 搭建開發環境開發環境
- rollup 開發環境搭建開發環境
- 搭建go開發環境Go開發環境
- Androdi開發環境搭建開發環境
- 前端開發環境搭建前端開發環境
- Theia 開發環境搭建開發環境
- QEMU 開發環境搭建開發環境
- Cordova 開發環境搭建開發環境