osgi.wiring.package; (&(osgi.wiring.package=com.google.gson)(版本>=2.3.0)(!(版本>=3.0.0))))

osgi.wiring.package; (&(osgi.wiring.package=com.google.gson)(version>=2.3.0)(!(version>=3.0.0))))

我正在尝试在我的 OSGi 包中使用 com.google.maps。我添加了这样的依赖项:

    <dependency>
      <groupId>com.google.maps</groupId>
      <artifactId>google-maps-services</artifactId>
      <version>0.1.7</version>
    </dependency>

但是,当我尝试将此捆绑包部署到 AEM 时,出现错误:

Unable to resolve 392.38: missing requirement [392.38] osgi.wiring.package; (&(osgi.wiring.package=com.google.gson)(version>=2.3.0)(!(version>=3.0.0))))

我该如何解决这个问题?

  • 转到 Maven 中心:http://search.maven.org
  • 高级搜索
  • 写入 按类名 部分:com.google.gson
  • 在结果列表中,找到可能适合您的结果
  • 下载 jars 并检查清单 header 是否导出了所需的包

如果这样做,您会发现以下 Maven 依赖项:

<dependency>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson</artifactId>
    <version>2.3.1</version>
</dependency>

或者,您可以使用 JPM 网站进行搜索,因为它索引了所有与 OSGi 相关的 MANIFEST header 并且它反映了整个 Maven 中央仓库。在找到您需要的工件后,它很可能最初来自 Maven Central(因此您不必在 Maven 项目中设置备用存储库)。您可以在详情页面查看捆绑包的来源。