Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
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"

Avatar

Level 1

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

1 Accepted Solution

Avatar

Correct answer by
Level 10
9 Replies

Avatar

Level 3

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>

Avatar

Level 6

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>

Avatar

Correct answer by
Level 10

Avatar

Level 6

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

Avatar

Employee Advisor

Hi,

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

kind regards,

Jörg

Avatar

Employee Advisor

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

Avatar

Level 6

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.

Avatar

Level 2

Hi @Nandhini Marimuthu

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

Updated pom.xml

imageFile.png

<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.  

core-pom-before-after.png

Thank you!

Regards

Hung Vu