# When bnd doesn't understand your dependencies

**URL:** <https://bnd.discourse.group/t/when-bnd-doesnt-understand-your-dependencies/68>\
**Category:** TIPS\
**Created:** [January 8, 2021, 9:08am UTC](https://bnd.discourse.group/t/when-bnd-doesnt-understand-your-dependencies/68 "2021-01-08T09:08:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pkriens](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/pkriens/32/3_2.png) [@pkriens](https://bnd.discourse.group/u/pkriens)\
**Post date:** [January 8, 2021, 9:08am UTC](https://bnd.discourse.group/t/when-bnd-doesnt-understand-your-dependencies/68/1 "2021-01-08T09:08:29Z")

</div>

In most cases, bnd is an understanding and committed abstract model. I find that most bnd users just assume they can depend on bnd. And for normal projects, this is justified since it looks at the `-buildpath` and `-testpath` and some other instructions.

However, sometimes bnd fails to see your needs. For example, I had a project where I used the [-export](https://bnd.bndtools.org/instructions/export.html) instruction to create an executable JAR. Such an executable JAR is defined in a `bndrun` file and bnd ignores those. So if you have any dependencies there, and the `-runbundles` is a big one, than bnd will miss them. This means the `-export` will be executed before all your dependencies are build. This can be tricky to spot because in Eclipse it tends to work but it fails on the CI because there we start from scratch.

The solution is the [-dependson](https://bnd.bndtools.org/instructions/dependson.html) instruction. This will tell bnd explicitly that there is more to a build.

```
-dependson com.example.foo, com.example.bar

```

The instruction takes a `SELECTOR`. A selector filters a _scope_. In the case of the `-dependson` instruction, the scope are all the projects in the current workspace. To prevent cycles, bnd will remove the current project. Sometimes, like the `export` example, or the integration test, you really want to be the last. You can do this with a wildcard.

```
-dependson *

```

It should be clear that only _one_ project can be the last. You will get a cycle error when you try to do this on multiple projects. Since this is a `SELECTOR` you can exclude projects. For example, if you have project `a`, `b`, and `c`. You want to build `c` last and `b` semi last.

```
c/bnd.bnd:
    -dependson *

b/bnd.bnd:
    -dependson !c,*

```
