Adding Maven support to OSGi applications
You can add Maven support to OSGi applications by converting the project to a Maven project. The converted project remains an OSGi application but configurations for the bundle, such as its ID, version, and its dependencies are defined in a pom.xml file.
Procedure
- Right-click the OSGi application and select .
-
Complete the Create New POM dialog
box.
Enter a Group Id, Artifact Id, and Version or accept the defaults. Optionally, enter a Name and Description. For Packaging, accept the default value.
- Click Finish.
Results
- A Project Object Model (POM) file, pom.xml, is generated for your project and contains all configuration, including the dependencies, from the existing manifest.mf file.
- The existing manifest.mf file is updated to indicate that the file is generated by the Maven project. Do not edit the generated manifest.mf file.
What to do next
- Install the server APIs in your Maven repository. For instructions,
see Installing the server APIs into the Maven repository. Tip: It is only necessary to install the API to the local repository one time.
- Add a dependency to the APIs. If you added the API to your Maven repository, right-click the project and select Group Id and Artifact Id fields are updated. Set Scope to provided. Click OK. . Select the module; the
For details of how to export packages from a JAR file in a Maven bundle, see the following subtopic: