某些库无法解析 AEM

AEM Cannot be resolved for some libs

Adobe CQ5,版本 5.5.0

com.day.cq.commons,version=[5.7,6) -- Cannot be resolved
com.day.cq.commons.jcr,version=[5.7,6) -- Cannot be resolved
com.day.cq.dam.api,version=[1.2,2) -- Cannot be resolved
com.day.cq.replication,version=[5.15,6) -- Cannot be resolved
com.day.cq.wcm.api,version=[1.2,2) -- Cannot be resolved
com.day.cq.wcm.api.components,version=[5.7,6) -- Cannot be resolved
com.day.cq.wcm.api.designer,version=[5.7,6) -- Cannot be resolved
org.apache.sling.api,version=[2.3,3) -- Cannot be resolved
org.apache.sling.api.resource,version=[2.5,3) -- Cannot be resolved
org.apache.sling.api.wrappers,version=[2.5,3) -- Cannot be resolved
org.apache.sling.commons.scheduler,version=[2.3,3) -- Cannot be resolved

例如:

我在 pom.xml 中使用 org.apache.sling.api <version>2.7.0</version> 并看到此错误 org.apache.sling.api,version=[2.3,3) -- Cannot be resolved -

我找到了类似的 question,如果按照下一个答案,我做的一切都是正确的 - 但我有同样的错误

The error message means that the OSGi framework is unable to supply a version >= 2.3 and < 3 of the org.apache.sling.api.resource Java package for a bundle B that wants to import it.

有谁知道如何解决这些错误?

我觉得你用的版本太新了org.apache.sling.api。因为在 CQ 5.6.1 上 <version>2.4.3-R1488084-B001</version> 用于这个包。

我建议你接下来做:

使用 Dependency Finder 检查 Sling/AEM POM 文件中的依赖项(您可以在那里找到它 /system/console/depfinder)。只需将 artifactId/package 放在那里,它就会为您提供正确的 Maven 依赖项。

例如对我来说它看起来像这样