本文介绍了如何在OpenDayLight Karaf中添加新功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何作为Karaf模块向ODL Oxygen SR3(0.8.3)添加新功能?

How can I add new features to ODL Oxygen SR3 (0.8.3) as a Karaf module?

例如,我从官方页面.然后,我想制作 Toaster示例作为氧气的新模块,它是使用以下命令创建的:

For example, I downloaded the prebuilt ODL from the official page. Then I'd like to make the Toaster sample as a new module for Oxygen, it was created with command:

wget -q -O - https://raw.githubusercontent.com/opendaylight/odlparent/master/settings.xml > ~/.m2/settings.xml
mvn archetype:generate -DarchetypeGroupId=org.opendaylight.archetypes -DarchetypeArtifactId=opendaylight-startup-archetype -DarchetypeCatalog=remote -DarchetypeVersion=1.1.0-SNAPSHOT

编译后,它将生成构建文件到本地Maven存储库(〜/.m2/repository/com/example/toaster ).我将 com/example/toaster 复制到Karaf默认存储库文件夹 ./karaf-0.8.3/system .然后,我想在 feature:list 中使用它,以便我可以使用 feature:install toaster 进行安装.首先,我需要将其添加到回购列表中:

After compiling, it would generate built files to a local maven repository (~/.m2/repository/com/example/toaster). I copied the com/example/toaster to the Karaf default repository folder ./karaf-0.8.3/system. Then I'd like to make it available in feature:list so I can install with feature:install toaster. First I need to add it to the repo list:

./karaf-0.8.3/bin/karaf
feature:repo-add mvn:com.example.toaster/features-toaster

不幸的是,它显示了一个错误:

Unfortunately it showed an error:

[在opendaylight快照( https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/)] :mvn:com.example.toaster/features-toaster

[Could not find artifact com.example.toaster:features-toaster:jar:0.1.0-SNAPSHOT in opendaylight-snapshot (https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/)] : mvn:com.example.toaster/features-toaster

以上命令基于这篇文章. repo-add 的正确方法是什么?

The above command is based on this post. What's the correct way to do repo-add?

推荐答案

请阅读 https://karaf.apache.org/manual/latest/#_artifacts_repositories_and_urls 文章.您需要做的基本上是将包含烤面包机的仓库URl添加到软件包中,如下所示:(上面链接的文档中的示例)

Please read the https://karaf.apache.org/manual/latest/#_artifacts_repositories_and_urlsArticle.What you need to do is basically add the repo URl that contains your toaster to the package like so:(Example from the documentation linked above)

<bundle>http://repo1.maven.org/maven2/org/apache/servicemix/nmr/org.apache.servicemix.nmr.api/1.0.0-m2/org.apache.servicemix.nmr.api-1.0.0-m2.jar</bundle>

存储库也可以使用属性来定义:

Repositories can also be defined using properties:

来源: https://karaf.apache.org/manual/latest/#_maven_url_handler

这篇关于如何在OpenDayLight Karaf中添加新功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-14 12:32