# Embedding dependencies in a URCap

**URL:** <https://forum.universal-robots.com/t/embedding-dependencies-in-a-urcap/498>\
**Category:** URCaps SDK\
**Created:** [January 30, 2017, 11:32am UTC](https://forum.universal-robots.com/t/embedding-dependencies-in-a-urcap/498 "2017-01-30T11:32:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/jbm/32/614_2.png) [@jbm](https://forum.universal-robots.com/u/jbm)\
**Post date:** [January 30, 2017, 11:32am UTC](https://forum.universal-robots.com/t/embedding-dependencies-in-a-urcap/498/1 "2017-01-30T11:32:25Z")

</div>

If you need to embed a necessary bundle for your URCap plugin, please refer to the [Apache Felix Maven Bundle Plugin](http://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html).

The bundle must be “embedded” inside the .urcap file, which essentially is a .jar file.  
Please check your `pom.xml` file for the `<Embed-Dependency>` tag, and embed the bundle through here.

You can check is the dependency is a success, by checking the .jar file after build for the referenced dependency.

Besides from embedding the necessary classes, OSGi will also expect `MANIFEST.mf` to include the correct Export-Package packages. However if the dependency already is a valid OSGi-bundle, this will happen automatically.

Please note, that since the URCap API uses generic OSGi, you should check out relevant Maven and OSGi manuals for further documentation.

---

<div class="post-metadata">

**Author:** ![anon93510157](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@anon93510157](https://forum.universal-robots.com/u/anon93510157)\
**Post date:** [February 21, 2017, 10:21pm UTC](https://forum.universal-robots.com/t/embedding-dependencies-in-a-urcap/498/2 "2017-02-21T22:21:08Z")

</div>

Hello,

I was able to embed the bundle in a urcap. I validated that the bundle is working with the Remote Shell. But the embedded bundle was not loaded automatically. Specifically, here is what I did on the Remove Shell:

- -\> ps # my embedded bundle is not listed
- -\> install file:///opt/usrim/[path-to-bundle]bundle.jar
- -\> ps # my bundle is in the installed state
- -\> start [my-bundle-id]
- -\> ps # by bundle is in the Active state, The Activator is executed.

My question is, how can I automatically load and start my embedded bundle?

Thanks.

Pierre

---

<div class="post-metadata">

**Author:** ![jbm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/jbm/32/614_2.png) [@jbm](https://forum.universal-robots.com/u/jbm)\
**Post date:** [February 23, 2017, 1:37am UTC](https://forum.universal-robots.com/t/embedding-dependencies-in-a-urcap/498/3 "2017-02-23T01:37:37Z")

</div>

@anon93510157

It seems you have not embedded the dependency in your URCap?  
But just has a bundle placed somewhere in the controller?

You should embed the dependency using `<Embed-Dependency>` tag, so you have exactly one bundle, which would be your .urcap file.  
If you have issues making this work, please upload your `pom.xml` file so I might investigate it.

---

<div class="post-metadata">

**Author:** ![anon93510157](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@anon93510157](https://forum.universal-robots.com/u/anon93510157)\
**Post date:** [February 23, 2017, 2:20pm UTC](https://forum.universal-robots.com/t/embedding-dependencies-in-a-urcap/498/4 "2017-02-23T14:20:18Z")

</div>

I want to be sure that I did not misunderstand your original post. This tag can be used to embed an additional OSGi bundle in my URCap? Is that right? So if I emded an additional bundle I should expect its Activator to be executed in addition to the URCap’s Activator. Is that right?

To answer your questions, I’m pretty sure I did use the tag since I can see my embedded bundle in the folder bundle.jar-embedded in the felix-cache. Here are my two pom.xml. The first one is the urcap. The second one is the OSGi addition bundle.

> **[Google Drive: Sign-in](https://accounts.google.com/v3/signin/identifier?dsh=S-888350322%3A1673731547880123&continue=https%3A%2F%2Fdrive.google.com%2Ffile%2Fd%2F0B9H6mDcCLW2oLUh4MVVWZ0U5ajg%2Fview%3Fusp%3Dsharing&followup=https%3A%2F%2Fdrive.google.com%2Ffile%2Fd%2F0B9H6mDcCLW2oLUh4MVVWZ0U5ajg%2Fview%3Fusp%3Dsharing&passive=1209600&service=wise&flowName=WebLiteSignIn&flowEntry=ServiceLogin&ifkv=AeAAQh6N90IME77xW-_MfwAg-QWzTF5-2NRhcgAJ7aq1iwn2Mp_E3-TmkhKJf8DhBc-GuW4_vCLmBQ)**
>
> Access Google Drive with a Google account (for personal use) or Google Workspace account (for business use).

> **[Google Drive: Sign-in](https://accounts.google.com/v3/signin/identifier?dsh=S-1693526932%3A1673731548975704&continue=https%3A%2F%2Fdrive.google.com%2Ffile%2Fd%2F0B9H6mDcCLW2oNDg3LWpYUWZTeFE%2Fview%3Fusp%3Dsharing&followup=https%3A%2F%2Fdrive.google.com%2Ffile%2Fd%2F0B9H6mDcCLW2oNDg3LWpYUWZTeFE%2Fview%3Fusp%3Dsharing&passive=1209600&service=wise&flowName=WebLiteSignIn&flowEntry=ServiceLogin&ifkv=AeAAQh4J-mHqTOE2ghiXxlq0mgnGw8KaIrqrOnMBdSKtwc-rxpc_MfSWRr8XJzJblFveD3QpcTACew)**
>
> Access Google Drive with a Google account (for personal use) or Google Workspace account (for business use).

---

<div class="post-metadata">

**Author:** ![anon93510157](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@anon93510157](https://forum.universal-robots.com/u/anon93510157)\
**Post date:** [February 28, 2017, 6:49pm UTC](https://forum.universal-robots.com/t/embedding-dependencies-in-a-urcap/498/5 "2017-02-28T18:49:23Z")

</div>

@jbm Can you take a look at my previous post. Thanks.

---

<div class="post-metadata">

**Author:** ![m.birkholz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/m.birkholz/32/7084_2.png) [@m.birkholz](https://forum.universal-robots.com/u/m.birkholz)\
**Post date:** [July 3, 2020, 12:17pm UTC](https://forum.universal-robots.com/t/embedding-dependencies-in-a-urcap/498/6 "2020-07-03T12:17:08Z")

</div>

Hi,

i faced a related issue today as i tried to use third-party jars and update their version with a urcap remote update. It seems that the embedded jars are not updated until their zombie copies in the felix-cache folder are dropped and replaced by the updated embedded jar from the urcap update.

Is there a way to clear these embedded jars in the felix cache folder on deployment?

---

<div class="post-metadata">

**Author:** ![m.birkholz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/m.birkholz/32/7084_2.png) [@m.birkholz](https://forum.universal-robots.com/u/m.birkholz)\
**Post date:** [July 7, 2020, 10:36am UTC](https://forum.universal-robots.com/t/embedding-dependencies-in-a-urcap/498/7 "2020-07-07T10:36:53Z")

</div>

Hi,

i found out that using **mvn clean install** instead **mvn install** solves the cache issue. It’s more likely a build lifecycle issue than a cache problem 😉
