Hello Forum!
I’m a relative gradle noob, so I apologize if this is redundant. I’m having problems getting jar files and osgi bundles packaged correctly with their respective manifest files.
I’m working on a larger application that consists of many eclipse java/web/osgi projects. In the eclipse workspace, all these projects contain manifest files with the appropriate configuration (exported packages, version, etc.). The workspace build in eclipse automatically uses these manifest files and the information contained therein to produce the desired archives. For example, the manifest file specifies a bundle name and version (e.g. 1.0.0.qualifier) which then translatest to _1.0.0..jar. This is the behavior I’d like to achieve with the gradle build, also.
For production, I’m working on setting up a build using gradle. This is a multi-project build, and I’m using the java and osgi plugins. However, I realized that gradle creates its own manifest file when creating the archive, and it doesn’t use the information contained inside the existing manifest files when creating the archive. The project name is the same as the bundle name, so the archiveBaseName is correct. But the version I have hard coded right now, which means I have to manually change it in two places to update.
When I move the existing Manifest file into the resource path, the version for the jar is still not set, but the manifest file is now included in the jar. However, I find some of the entries are missing from the manifest file inside the jar (e.g. Bundle-RequiredExecutionEnvironment is gone; some of the packages on the import list are no longer there) and others changed (Bundle-Version is no longer 1.0.0.qualifier but 0.0.0.unspecified).
Is there something I’m doing wrong? Is there an elegant way of making sure the archives are created with the correct manifest file information and the archive names reflect this information?