【问题标题】:Imported Packages : com.day.cq.wcm.api,version=[1.29,2) and org.apache.sling.api.resource,version=[2.12,3) -- Cannot be resolved导入包:com.day.cq.wcm.api,version=[1.29,2) 和 org.apache.sling.api.resource,version=[2.12,3) -- 无法解决
【发布时间】:2021-03-01 23:36:55
【问题描述】:

在使用来自https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/archetype/overview.html?lang=en#available-properties 的原型 24 创建 AEM 项目后,我遇到了一个奇怪的问题

项目成功构建并完美部署,由于以下粗体问题,osgi 包不是“活动”:com.day.cq.wcm.api,version=[1.29,2) -- 无法解决并且org.apache.sling.api.resource,version=[2.12,3) -- 无法解析

Imported Packages:

**com.day.cq.wcm.api,version=[1.29,2) -- Cannot be resolved**

**org.apache.sling.api.resource,version=[2.12,3) -- Cannot be resolved**

我已尝试在 http://localhost:4502/system/console/depfinder 中找到的父 pom 中添加这些依赖项

不知怎的,我的努力未能解决这个问题,谁能帮我解决这个问题。

提前致谢

【问题讨论】:

  • 我通过在 Import-packages 的核心 pom 文件的 build 部分中添加未解析的 apis 作为 Import-Package: javax.annotation;version=0.0.0,com.day 找到了解决方案。 cq.wcm.api;version=0.0.0,org.apache.sling.api.resource;version=0.0.0,*

标签: osgi


【解决方案1】:

您为“解决”问题所做的就是告诉您的捆绑软件接受任何版本的软件包。这很可能会在以后导致问题,因为您可能会得到不兼容的实现。

相反,您应该使用 AEM/sling 中的系统控制台捆绑包视图来找出捆绑包提供了哪些版本的包。可能版本低于 1.29 和 2.12。

因此,正确的解决方案是使用与 AEM/sling 系统提供的版本相匹配的旧版本原型。

【讨论】:

    【解决方案2】:

    请将网站语言更改为英文并在此处阅读文章:https://flagtick.com/post/getting-started-with-aem-sites-setup-project-eduzone-system-part-7 可能对你有一点帮助。

                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.sling</groupId>
                        <artifactId>org.apache.sling.caconfig.bnd-plugin</artifactId>
                        <version>1.0.2</version>
                    </dependency>
                </dependencies>
            </plugin>
    

    【讨论】:

      【解决方案3】:

      我对原型 26 也有同样的问题。

      通过在 core/pom.xml 中添加此依赖项解决

      <!-- https://mvnrepository.com/artifact/com.day.cq.wcm/cq-wcm-api -->
      <dependency>
          <groupId>com.day.cq.wcm</groupId>
          <artifactId>cq-wcm-api</artifactId>
          <version>5.9.4</version>
          <scope>provided</scope>
      </dependency>
      <!-- https://mvnrepository.com/artifact/org.apache.sling/org.apache.sling.api -->
              <dependency>
                  <artifactId>org.apache.sling.api</artifactId>
                  <version>2.18.4</version>
                  <groupId>org.apache.sling</groupId>
                  <scope>provided</scope>
              </dependency>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-26
        • 2017-04-25
        • 2015-06-02
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多