是否可以使用 maven 生成 OSGI 模块? 通常我可以生成一个像
这样的项目mvn -B archetype:generate \
-DarchetypeGroupId=org.apache.maven.archetypes \
-DgroupId=com.my.company \
-DartifactId=hello-world
是否有类似的方法来获取 OSGI 模块?
最佳答案
不确定。原型(prototype)可能有点过时了。我只是创建一个普通的 Maven 项目并添加 bnd-maven-plugin在父级(see here for an example)。
或者,您可以使用 maven-bundle-plugin。 See here .
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<goals>
<goal>bnd-process</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.5</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
有了这个礼物,您所有的模块都将是 bundle 。如果您需要调整 Manifest 设置,那么您可以在模块中创建一个 bnd.bnd 文件。您可以手动或使用 bndtools bnd 文件编辑器对其进行编辑。
关于java - 如何用maven生成OSGI模块?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40979047/