Ask Your Question
0

How to install new features in Karaf?

asked 2015-08-19 21:33:12 -0700

zzy gravatar image

Hello,

I'm new to Opendaylight and want to add my new features, ie. modules, to the controller. I followed this guidance: https://wiki.opendaylight.org/view/Karaf:StepbyStep_Guide

Every step is OK without fatal errors. However, when I run distribution-karaf/target/assembly/bin/karaf, I don't find my module in the feature list (feature:list | grep zzy - I use features-zzy as artifactId).

In more detail, I get the repository by git clone https://git.opendaylight.org/gerrit/openflowplugin.git openflowplugin;. When creating the feature folder by mvn archetype:generate -DarchetypeGroupId=org.opendaylight.controller -DarchetypeArtifactId=opendaylight-karaf-features-archetype -DarchetypeRepository=http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/ -DarchetypeCatalog=http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/archetype-catalog.xml (from the tutorial mentioned at the beginning), I set the parameters as following:

groupId: (a random number)

artifactId: features-zzy

version: (default)

package: (default)

repoName: zzy

And as the tutorial suggested, I renamed the result folder from "features-zzy" to "features", renamed this module names inside pom file, and copied the pom.xml as well as features.xml from the sample features folder (existing in the original repository). Then I created the folder "distribution-karaf", compiled it, run distribution-karaf/target/assembly/bin/karaf and don't find my module inside karaf console.

The parameters here I used are:

groupId: (the same random number as above)

artifactId: distribution-karaf

version: (default)

package: (default)

repoName: zzy

Do I miss anything here to load my new module? Any ideas for this? I'm indeed a newbie in odl world.

Thanks in advance!

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2015-08-21 12:09:15 -0700

Mandeep gravatar image

updated 2015-08-22 22:42:40 -0700

If your module built and installed successfully using mvn clean install. That mean it is available in local repository (~/.m2/repository/). Then you have to tell karaf about your module, which can be done by add repository in karaf using following karaf command:

feature:repo-add mvn:zzy/simpleapp/features-zzy/1.0-SNAPSHOT/xml/features

Format for above command is:

feature:repo-add mvn:$group-id$/$artifactId$/$repository-location$/$version$/xml/features

In your case:

$group-id$ = zzy. This is what you given while creating artifact.

$repository-location$ = features-zzy. This is folder name in repository, which you renamed and copied.

$version$ = 1.0.-SNAPSHOT. This is what you given while creating artifact.

edit flag offensive delete publish link more

Comments

Thank you for the reply! I've tried the command but get such error msg: "Error executing command: Error resolving artifact zzy:features-zzy:xml:features:0.1.0-SNAPSHOT: Could not find artifact zzy:features-zzy:xml:features:0.1.0-SNAPSHOT in apache (http://repository.apache.org/content/groups/snapshots-group/)". (The same as I replied to nevalosa) - At ~/.m2, I find the folder for my feature. However, there is no .jar there, the only file is 0.1.0-SNAPSHOT/resolver-status.properties. I guess this is the reason I couldn't find the module in Karaf. I install my feature by `mvn install -DskipTests`. Do I miss anything here?

zzy ( 2015-08-22 04:09:39 -0700 )edit

I gave command based on your initial query. Can you share directory structure inside .m2/repository/?

Mandeep ( 2015-08-22 05:06:18 -0700 )edit

Sure. Under /Users/zzy/.m2/repository, the structure is: https://github.com/zhenyu-zhou/m2 (Sorry I couldn't type in structure here and have to move it to github)

zzy ( 2015-08-22 07:06:53 -0700 )edit

Guess, your app name is simpleapp, I m not sure about version... Following command should work: `feature:repo-add mvn:zzy/simpleapp/features-zzy/1.0-SNAPSHOT/xml/features` Or below should work, `feature:repo-add mvn:zzy/simpleapp/features-zzy/0.1.0-SNAPSHOT/xml/features`

Mandeep ( 2015-08-22 11:31:07 -0700 )edit

Thanks again! Both commands could find the repository however... Do you have any suggestions about how to build the URL in general? Sorry I never used maven and karaf before.

zzy ( 2015-08-22 19:16:36 -0700 )edit
0

answered 2015-08-20 18:44:45 -0700

nevalosa gravatar image

You can check whether there is any exception or warning reported when you execute under Karaf stet by step by log:tail. After install, check the directory $KARAFHOME/system (your KARAFHOME might be distribution-karaf/target/assembly) whether feature jars exist in these repository (jar path is same as maven).

edit flag offensive delete publish link more

Comments

This [quest post](https://ask.opendaylight.org/question/3364/how-to-insert-vtn-into-controller/?answer=3398#post-id-3398) might help you.

nevalosa ( 2015-08-20 18:49:57 -0700 )edit

Thank you! But I don't find anything useful in log - there seems to be no error there. In my $KARAFHOME/system, I find many .pom files (rather than .jar), but nothing for my module. At ~/.m2, I find the folder for my feature. However, there is no .jar there, the only file is 0.1.0-SNAPSHOT/resolver-status.properties. I guess this is the reason I couldn't find the module in Karaf. I install my feature by `mvn install -DskipTests`. Do I miss anything here?

zzy ( 2015-08-22 04:06:12 -0700 )edit
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2015-08-19 21:33:12 -0700

Seen: 1,286 times

Last updated: Aug 22 '15