Raj Kumar Samala
Raj Kumar Samala

Reputation: 560

Fix com.day.cq.commons,version=[5.7,6) can't be resolved in OSGi Bundles in AEM 6.2

when you working with AEM 6.2 you might have came across below error,

com.day.cq.commons,version=[5.7,6)-->can't be resolved

This happened in AEM 6.2 Versions

I answered below.

Upvotes: 0

Views: 3010

Answers (2)

Raj Kumar Samala
Raj Kumar Samala

Reputation: 560

Another Solution for this issue is :

copy and paste “cq-commons-5.9.26.jar” file in /.m2/repository/com/day/cq/cq-commons/5.9.26

and update pom dependency to below :

    <dependency>
        <groupId>com.day.cq</groupId>
        <artifactId>cq-commons</artifactId>
        <version>5.9.26</version>
        <scope>provided</scope>
    </dependency>

Upvotes: 2

Raj Kumar Samala
Raj Kumar Samala

Reputation: 560

Solution:

  1. Add below dependency in AEM Core Project pom.xml file

    <dependency>
          <groupId>com.day.cq</groupId>
          <artifactId>cq-commons</artifactId>
          <version>5.7.4</version>
      </dependency>

  1. Add Import Package in Core pom.xml

<Import-Package>
         com.day.cq.commons;version="[5.7.0,7.0)",
</Import-Package>

build maven and deploy the project in AEM. build should be in active state.

references:

The instruction is a list of packages that are required by the bundle's contained packages. The default for this header is "*", resulting in importing all referred packages.

This header rarely has to be explicitly specified. However, in certain cases when there is an unwanted import, such an import can be removed by using a negation package pattern. The package patterns work in the same way as for , which means they are ordered.

For example, if you wanted to import all packages except org.foo.impl you would specify "!org.foo.impl,*"

Upvotes: 1

Related Questions