Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Problem with Maven Dependency tags with SlingModels

Avatar

Level 1

I'm having a slight problem with incorporating the appropriate maven dependencies into my project for sling models.

When I deploy my bundle, I get the following import that can't be resolved:

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

I believe I have included this with the following dependencies:

<dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.models.api</artifactId> </dependency> <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.models.impl</artifactId> </dependency>

I tried using:

<Embed-Transitive>true</Embed-Transitive> <Import-Package>*</Import-Package>

in my bundle compile instructions, but this has just resulted in a ton of other dependencies not being resolved.

Surely I've gone down the garden path here somewhere. Any help would be greatly appreciated.

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi,

It appears that your code is dependening upon a newer version of the Sling Models API than is available in your AEM instance. Your two options are to depend upon an older version of the API or to deploy a newer version of Sling Models into your instance.

Two additional comments:

  • You should not embed the Sling Models dependencies (actually, you try to avoid any embedding, but for now, let's just talk about Sling Models smiley).
  • There's no need for you to include the Impl bundle as a dependency.

Regards,

Justin

View solution in original post

3 Replies

Avatar

Correct answer by
Employee

Hi,

It appears that your code is dependening upon a newer version of the Sling Models API than is available in your AEM instance. Your two options are to depend upon an older version of the API or to deploy a newer version of Sling Models into your instance.

Two additional comments:

  • You should not embed the Sling Models dependencies (actually, you try to avoid any embedding, but for now, let's just talk about Sling Models smiley).
  • There's no need for you to include the Impl bundle as a dependency.

Regards,

Justin

Avatar

Level 1

Hi Justin,

Thanks, that's correct. I'll figure out an appropriate way to get the jar into the instance.

Avatar

Employee

You might want to use the convienence content packages we have on GitHub. I typically keep these at most a day or two behind the actual Sling releases. Here's the latest one: https://github.com/Adobe-Consulting-Services/com.adobe.acs.bundles.sling-models/releases/tag/com.ado...