On using AWSSDK some dependencies are not resolved | Community
Skip to main content
Level 2
March 23, 2021
Solved

On using AWSSDK some dependencies are not resolved

  • March 23, 2021
  • 2 replies
  • 6890 views

Hi Experts,

 

I have to use Amazon SQS to read product information from queue in my AEM project and for that I am adding below dependencies to my parent pom.xml

<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bom</artifactId>
<version>2.15.14</version>
<type>pom</type>
<scope>import</scope>
</dependency>

 

and in core/pom.xml as 

 

<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sqs</artifactId>
</dependency>

  

I have added my package where I am using AWS APIs under <Export-Package> and under groupId of <Embed-Dependency> as well.

I have put my custom logic which is leveraging AWS SQS inside the core bundle. On deployment, AWS packages are not getting resolved at Felix Console.

 

How to resolve these? I am trying the plugin approach but seems every time I am adding new packages to the manifest export list I am seeing new packages which start showing not resolved issues.

 

like below list:

 

io.netty.bootstrap,version=[4.1,5) -- Cannot be resolved
io.netty.buffer,version=[4.1,5) -- Cannot be resolved
io.netty.channel,version=[4.1,5) -- Cannot be resolved
io.netty.channel.epoll,version=[4.1,5) -- Cannot be resolved
io.netty.channel.nio,version=[4.1,5) -- Cannot be resolved
io.netty.channel.pool,version=[4.1,5) -- Cannot be resolved
io.netty.channel.socket.nio,version=[4.1,5) -- Cannot be resolved
io.netty.handler.codec -- Cannot be resolved
io.netty.handler.codec.http,version=[4.1,5) -- Cannot be resolved
io.netty.handler.codec.http2,version=[4.1,5) -- Cannot be resolved
io.netty.handler.logging,version=[4.1,5) -- Cannot be resolved
io.netty.handler.ssl,version=[4.1,5) -- Cannot be resolved
io.netty.handler.ssl.util,version=[4.1,5) -- Cannot be resolved
io.netty.handler.timeout,version=[4.1,5) -- Cannot be resolved
io.netty.util,version=[4.1,5) -- Cannot be resolved
io.netty.util.concurrent,version=[4.1,5) -- Cannot be resolved
io.netty.util.internal,version=[4.1,5) -- Cannot be resolved

 

Thanks

 

Regards

Shy

 

 

 

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 Vijayalakshmi_S

Hi @shya,

Add below as part of  <instructions> in maven-bundle-plugin in addition to <Embed-Depedendency>

<Embed-Transitive>true</Embed-Transitive>  
This is responsible for including the dependencies which AWS SQS is dependent on. (AKA Transitive dependencies)
Also, it is suffice to use SQS dependency alone in both main and core/pom.xml (In core/pom.xml, we need not specify the version)

 

<!-- https://mvnrepository.com/artifact/software.amazon.awssdk/sqs --> <dependency> <groupId>software.amazon.awssdk</groupId> <artifactId>sqs</artifactId> <version>2.16.25</version> </dependency>

 

If you are using bnd-maven-plugin to build core module, above entry is not applicable. In that case, create OSGI bundle out of SQS dependency separately outside your project using maven-bundle-plugin.
Recently, had a chance to try AWS SNS in AEM and details about it is available in https://myaemlearnings.blogspot.com/2021/03/aws-service-in-aem.html
Let know if you are facing any issues still.

2 replies

bilal_ahmad
Level 5
March 24, 2021

Hey @shya try replacing :

<scope>import</scope>

with

<scope>provided</scope>

 

Thanks,

Bilal.

Vijayalakshmi_S
Vijayalakshmi_SAccepted solution
Level 10
March 24, 2021

Hi @shya,

Add below as part of  <instructions> in maven-bundle-plugin in addition to <Embed-Depedendency>

<Embed-Transitive>true</Embed-Transitive>  
This is responsible for including the dependencies which AWS SQS is dependent on. (AKA Transitive dependencies)
Also, it is suffice to use SQS dependency alone in both main and core/pom.xml (In core/pom.xml, we need not specify the version)

 

<!-- https://mvnrepository.com/artifact/software.amazon.awssdk/sqs --> <dependency> <groupId>software.amazon.awssdk</groupId> <artifactId>sqs</artifactId> <version>2.16.25</version> </dependency>

 

If you are using bnd-maven-plugin to build core module, above entry is not applicable. In that case, create OSGI bundle out of SQS dependency separately outside your project using maven-bundle-plugin.
Recently, had a chance to try AWS SNS in AEM and details about it is available in https://myaemlearnings.blogspot.com/2021/03/aws-service-in-aem.html
Let know if you are facing any issues still.
shyaAuthor
Level 2
March 25, 2021

Hi @vijayalakshmi_s,

parent pom.xml is having below entry

<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sqs</artifactId>
<version>2.16.25</version>
</dependency>

 

here is my core/pom.xml

 

<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sqs</artifactId>
</dependency>

 

maven-bundle-plugin is 

 

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Sling-Model-Packages>
com.shya.www.core.models,com.aem.community.core,com.shya.www.core.cache.model
</Sling-Model-Packages>
<Import-Package>
javax.inject;version=0.0.0,com.day.cq.replication;version="[6.0.0,7)",
com.day.cq.workflow;version="[1.0,2)",
com.day.cq.workflow.exec;version="[1.0,2)",
com.day.cq.workflow.metadata;version="[1.0,2)",
org.apache.sling.models.annotations;version="[1.1,2)",
com.day.cq.commons.jcr;version="[5.7.0,7.0.0)",
*
</Import-Package>
<Private-Package>org.apache.commons.lang.*</Private-Package>
<Export-Package>
com.shya.aem.*,
com.shya.www.core.service.*,
com.shya.www.core.services.*,
com.shya.www.core.*,
</Export-Package>
<Embed-Dependency>
json,jxl,commons-collections4,*;scope=compile|runtime,jsoup;inline=true
</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
</instructions>
</configuration>
</plugin>

 

here is what I am seeing in the felix console

 

~Shya