java - How to specify class files with bnd
问题描述
I already successfully used the standalone bnd tool to create an OSGi bundle from a jar file.
Now I would like to create a bundle starting from .class files.
By looking at some of the official bnd documentation I couldn't find anything to do this.
I guess I'm looking for something like -classpath: output.jar
that could work for .class files.
解决方案
If I understood what you are trying to do, one option could be to set up a maven project and take advantage of the bnd-maven-plugin
as described here. Basically, it is enough to add the following snippet in the build/plugins section of your pom:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>bnd-process</goal>
</goals>
</execution>
</executions>
</plugin>
For a complete example of a maven-based approach you can refer to the OSGi enRoute website: https://enroute.osgi.org/Tutorial/
推荐阅读
- database - 在 SQL Server 2016 中创建数据库时,日志文件大小很大
- ios - Xamarin iOS 过多的移动设备预配文件通过 Visual Studio 复制到 Mac
- c# - 无法使用 .net 核心将类转换为 System.Linq.IQueryable
- css - CSS 中的媒体屏幕代码无法按预期工作
- javascript - 获取div元素jquery的p元素的数据
- laravel - 获取相关列 HasManyThrough,设置为响应
- perl - Perl readdir 警告 - 名称“main::DIR”仅使用一次:可能的错字
- database - 与重复的多对多关系
- javascript - 使用另一个数组更新丑陋的对象键
- java - Spring Exception 评估 SpringEL 表达式