When I use WCMUsePojo in bundles, bundle is not get resolved, as its import package says "com.adobe.cq.sightly,version=[2.5,3) -- Cannot be resolved" | Community
Skip to main content
PrakashSB-aMtip
May 6, 2017
Solved

When I use WCMUsePojo in bundles, bundle is not get resolved, as its import package says "com.adobe.cq.sightly,version=[2.5,3) -- Cannot be resolved"

  • May 6, 2017
  • 9 replies
  • 6005 views

When I use WCMUsePojo in AEM 6.3 bundles, bundle is not resolved, as its import package says "com.adobe.cq.sightly,version=[2.5,3) -- Cannot be resolved".

Attached the error snapshot file

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

See our article on this exact subject -- Creating an Adobe Experience Manager 6.3 HTL component that uses the WCMUsePojo API

9 replies

Nandhini_Marimu
Level 2
May 8, 2017

Hi Prakash,

            Add the package name in pom.xml of that particular bundle and do mvn clean install. Hope it should work for you.

Example: In your case, add like this in your pom.xml

<Import-Package>
              com.adobe.cq.sightly;version="2.5.3"
  </Import-Package>

Level 5
June 15, 2017

Hi Nandhini:

I am using sling model, and have the same issue, which is "com.adobe.cq.sightly,version=[2.5,3) -- Cannot be resolved", I tried to add the above import-package before or after the <Sling_model-Packages>, the build doesn't work. Just wonder if you can help and let me know where to add this import-package or should we have different syntax for sling model?

Thanks.

Here is part of pom.xml

<plugin>

                <groupId>org.apache.felix</groupId>

                <artifactId>maven-bundle-plugin</artifactId>

                <extensions>true</extensions>

                <configuration>

                    <instructions>

                      <Bundle-SymbolicName>Nextgen-Touch-Content</Bundle-SymbolicName>

                       <Sling-Model-Packages>bundle-ngm-content</Sling-Model-Packages>

                    </instructions>

                </configuration>

            </plugin>

            <plugin>

                <groupId>org.apache.felix</groupId>

                <artifactId>maven-scr-plugin</artifactId>

                <configuration>

                    <instructions>

                        <Sling-Model-Packages>

                            bundle-ngm-content

                        </Sling-Model-Packages>

                    </instructions>

                </configuration>

                <executions>

                    <execution>

                        <id>generate-scr-scrdescriptor</id>

                        <goals>

                            <goal>scr</goal>

                        </goals>

                    </execution>

                </executions>

            </plugin>

smacdonald2008
smacdonald2008Accepted solution
Level 10
June 15, 2017
Level 5
June 15, 2017

I get it to work without double quotes around the version

<import-Package>

              com.adobe.cq.sightly,version=[2.5,3)

</import-Package>

But get another error.

org.apache.sling.models.annotations,version=[1.5,2) -- Cannot be resolved

joerghoh
Adobe Employee
Adobe Employee
June 15, 2017

Hi,

what version of the uber.jar are you using? And what version of AEM are you deploying to?

kind regards,

Jörg

Level 5
June 15, 2017

Uber-jar 6.3.0 and AEM 6.3.

joerghoh
Adobe Employee
Adobe Employee
June 15, 2017

AEM 6.3 comes with the sling models API 1.3.2, which exports org.apache.sling.models.annotations in version 1.4.0. I just checked the uber.jar for 6.3 as well and it also exports this package in version 1.4.0

When you compile against org.apache.sling.models.annotations,version=[1.5,2)

then you are likely compiling against sling models 1.3.4, which exports this java package in version 1.5.0.

So can you please share your project in a minimal way, so we can try to build it ourselves? For me it seems that you build against different artifacts and not only the AEM 6.3 uber.jar

kind regards,
Jörg

Level 5
June 15, 2017

Thank you so much.

I removed the sling model 1.3.4 in the dependency. Now it works.

Don't need <import-package> line as well.

Level 2
January 14, 2018

Hi @Nandhini Marimuthu

I would like confirm that it works for me with your mention.

Updated pom.xml

<Import-Package>javax.inject;version=0.0.0,com.adobe.cq.sightly;version=2.5.3,*</Import-Package>

P/S: I created new project by using maven archetype which is recommended in Creating an Adobe Experience Manager 6.3 Project using Adobe Maven Archetype 11​. It's working well. But it won't work once I added more dependencies in the core module.  

Thank you!

Regards

Hung Vu