Reputation: 21025
I was following this Bndtools tutorial http://bndtools.org/tutorial.html to implement a simple greeting service.
First, I created this interface in bundle org.example.api
:
package org.example.api;
public interface Greeting {
String sayHello( String name );
}
Then a service that implements the above interface in bundle org.example.impl
:
package org.example.impl;
import org.osgi.service.component.annotations.Component;
@Component
public class GreetingComponent implements Greeting {
public String sayHello( String name ) {
return "Hello " + name;
}
}
Of course, the type Greeting
cannot be resolved. And here comes my question: what is the designated way to add the package import declaration to the impl
bundle? I am aware that I could manually edit bnd.bnd
of org.example.impl
to include the necessary package in the -buildpath
directive.
But that is rather inconvenient: memorize the package name, navigate to the appropriate bnd file, edit the directive, save. Isn't here a more convenient way to add the missing import?
I was looking for something like a quick fix (Ctrl+1) but that doesn't seem to exist.
Upvotes: 2
Views: 717
Reputation: 927
You have to maintain the Build Path/Bnd Bundle Path and APIs via the bnd.bnd Bnd Project Editor
.
Take care to open the correct editor. File association *.bnd
is in some Eclipse instances associated to Text Editor, instead of Bnd Bundle Editor.
Open the bnd file with Bnd Project Editor
and add the bundles for the build path either via
Repository
view +
with search functionalitySource Tab
is also an optionIMHO DnD is easiest and fastest way ;-)
Upvotes: 0