在没有 karaf 控制台的情况下在 pom.xml 中安装 org.json

Install org.json in pom.xml without karaf console

我的 servicemix 项目需要 org.json 依赖项。此依赖项尚不存在,因此我需要导入并安装它。

这就是我添加依赖项的方式:

    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20170516</version>
    </dependency>

我可以使用以下方法在 karaf 中安装它:

install wrap:mvn:org.json/json/20170516

但我想通过我的 pom.xml 或 feature.xml 安装它,这样我就不必在每次构建我的 servicemix 服务器时都安装它。

您始终可以创建自定义功能文件。 ref

<features name="Features(JSON)">
    <feature name="org.json" version="20170516" description="JSON Library">
        <bundle start="true" start-level="80">mvn:org.json/json/20170516</bundle>
    </feature>
</features>

并使用命令

将其添加到 karaf 中
feature:repo-add