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
New Participant
May 6, 2017 11:44 AM UTC
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"

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.
smacdonald2008
smacdonald2008Accepted solution
Level 10
Jun 15, 2017 5:30 PM UTC

9 replies

Level 2
Jan 14, 2018 5:12 AM UTC

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

Translate
Level 5
Jun 15, 2017 9:20 PM UTC

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.

Translate
joerghoh
Employee
Jun 15, 2017 9:12 PM UTC

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

Translate
Level 5
Jun 15, 2017 8:51 PM UTC

Uber-jar 6.3.0 and AEM 6.3.

Translate
joerghoh
Employee
Jun 15, 2017 8:49 PM UTC

Hi,

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

kind regards,

Jörg

Translate
Level 5
Jun 15, 2017 8:41 PM UTC

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

Translate
smacdonald2008
smacdonald2008Accepted solution
Level 10
Jun 15, 2017 5:30 PM UTC
Level 5
Jun 15, 2017 3:25 PM UTC

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>

Translate
Nandhini_Marimu
Level 2
May 8, 2017 9:38 AM UTC

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>

Translate