1。从https://raw.githubusercontent.com/opendaylight/odlparent/stable/carbon/settings.xml下载此文件或拷贝此文件内容,替换
root@odl_ubuntu:/etc/maven#
目录下的同名文件。
2。用如下Maven命令生成项目骨架:
root@odl_ubuntu:/home/myodl# mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeGroupId=org.opendaylight.controller -DarchetypeArtifactId=opendaylight-startup-archetype -DarchetypeRepository=https://nexus.opendaylight.org/content/repositories/public -DarchetypeVersion=1.3.2-Carbon
生成过程中在如下位置输入如下黑体内容:
Define value for property 'groupId': : org.opendaylight.topology
Define value for property 'artifactId': : topology
[INFO] Using property: version = 0.1.0-SNAPSHOT
Define value for property 'package': org.opendaylight.topology: :
Nov 16, 2018 12:54:38 AM org.apache.velocity.runtime.log.JdkLogChute log
INFO: FileResourceLoader : adding path '.'
Define value for property 'classPrefix': Topology: :
Define value for property 'copyright': : ZebraDecoder
[INFO] Using property: copyrightYear = 2017
Confirm properties configuration:
groupId: org.opendaylight.topology
artifactId: topology
version: 0.1.0-SNAPSHOT
package: org.opendaylight.topology
classPrefix: Topology
copyright: ZebraDecoder
copyrightYear: 2017
Y: : Y
项目骨架创建完成后提示如下:
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: opendaylight-startup-archetype:1.3.2-Carbon
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: org.opendaylight.topology
[INFO] Parameter: artifactId, Value: topology
[INFO] Parameter: version, Value: 0.1.0-SNAPSHOT
[INFO] Parameter: package, Value: org.opendaylight.topology
[INFO] Parameter: packageInPathFormat, Value: org/opendaylight/topology
[INFO] Parameter: classPrefix, Value: Topology
[INFO] Parameter: package, Value: org.opendaylight.topology
[INFO] Parameter: version, Value: 0.1.0-SNAPSHOT
[INFO] Parameter: copyright, Value: ZebraDecoder
[INFO] Parameter: groupId, Value: org.opendaylight.topology
[INFO] Parameter: artifactId, Value: topology
[INFO] Parameter: copyrightYear, Value: 2017
[WARNING] Don't override file /home/myodl/topology/pom.xml
[INFO] project created from Archetype in dir: /home/myodl/topology
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:27 min
[INFO] Finished at: 2018-11-16T00:56:22-08:00
[INFO] Final Memory: 12M/28M
[INFO] ------------------------------------------------------------------------
同时生成topology文件夹,进去后的内容如下:
root@odl_ubuntu:/home/myodl/topology# ll
total 56
drwxr-xr-x 10 root root 4096 Nov 16 00:56 ./
drwxr-xr-x 3 root root 4096 Nov 16 00:56 ../
drwxr-xr-x 3 root root 4096 Nov 16 00:56 api/ ---YANG模型目录
drwxr-xr-x 2 root root 4096 Nov 16 00:56 artifacts/ ---项目组件坐标管理目录
drwxr-xr-x 3 root root 4096 Nov 16 00:56 cli/ ---karaf cli命令代码开发目录
-rw-r--r-- 1 root root 1682 Nov 16 00:56 deploy-site.xml ---部署的配置文件,可以忽略
drwxr-xr-x 3 root root 4096 Nov 16 00:56 features/ ---feature组织管理目录
-rw-r--r-- 1 root root 160 Nov 16 00:56 .gitignore
-rw-r--r-- 1 root root 88 Nov 16 00:56 .gitreview
drwxr-xr-x 3 root root 4096 Nov 16 00:56 impl/ ---业务逻辑的代码实现目录
drwxr-xr-x 3 root root 4096 Nov 16 00:56 it/ ---集成测试目录
drwxr-xr-x 2 root root 4096 Nov 16 00:56 karaf/ ---karaf打包目录
-rw-r--r-- 1 root root 3576 Nov 16 00:56 pom.xml ---项目跟pom文件,描述maven项目的基本信息
drwxr-xr-x 4 root root 4096 Nov 16 00:56 src/
3。在topology目录下编译工程:
root@odl_ubuntu:/home/myodl/topology# mvn clean install -DskipTests -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true
其中:
-DskipTests表示不执行测试用例
-Dmaven.javadoc.skip=true表示跳过javadoc
-Dcheckstyle.skip=true表示跳过checkstyle检查
(编译过程慢的吓人,请做好思想准备!!!)
最后:
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] ODL :: org.opendaylight.topology :: topology-api ... SUCCESS [ 48.459 s]
[INFO] ODL :: org.opendaylight.topology :: topology-impl .. SUCCESS [ 4.285 s]
[INFO] ODL :: org.opendaylight.topology :: topology-cli ... SUCCESS [ 2.404 s]
[INFO] ODL :: org.opendaylight.topology :: topology-features SUCCESS [ 17.044 s]
[INFO] ODL :: org.opendaylight.topology :: topology-karaf . SUCCESS [ 02:47 h]
[INFO] ODL :: org.opendaylight.topology :: topology-artifacts SUCCESS [ 9.582 s]
[INFO] ODL :: org.opendaylight.topology :: topology-it .... SUCCESS [ 37.510 s]
[INFO] topology ........................................... SUCCESS [ 37.923 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:50 h
[INFO] Finished at: 2018-11-16T10:17:09-08:00
[INFO] Final Memory: 189M/357M
[INFO] ------------------------------------------------------------------------
root@odl_ubuntu:/home/myodl/topology#
开启:
root@odl_ubuntu:/home/myodl/topology# ./karaf/target/assembly/bin/karaf
100% [========================================================================]
Karaf started in 103s. Bundle stats: 295 active, 295 total
________ ________ .__ .__ .__ __
\_____ \ ______ ____ ____ \______ \ _____ ___.__.| | |__| ____ | |___/ |_
/ | \\____ \_/ __ \ / \ | | \\__ \< | || | | |/ ___\| | \ __\
/ | \ |_> > ___/| | \| ` \/ __ \\___ || |_| / /_/ > Y \ |
\_______ / __/ \___ >___| /_______ (____ / ____||____/__\___ /|___| /__|
\/|__| \/ \/ \/ \/\/ /_____/ \/
Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown OpenDaylight.
opendaylight-user@root>
未完待续!
所有评论(0)