Problem with Maven Dependency tags with SlingModels | Community
Skip to main content
October 16, 2015
Solved

Problem with Maven Dependency tags with SlingModels

  • October 16, 2015
  • 3 replies
  • 872 views

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.

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 JustinEd3

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

3 replies

JustinEd3Adobe EmployeeAccepted solution
Adobe Employee
October 16, 2015

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

October 16, 2015

Hi Justin,

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

Adobe Employee
October 16, 2015

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.adobe.acs.bundles.sling-models-1.0.4