Anyone was able to use awssdk in a Liferay 7 moduleAnyone was able to use awssdk in a Liferay 7 modulehttps://liferay.dev/en/c/message_boards/find_thread?p_l_id=119785333&threadId=1213053932024-03-29T08:54:22Z2024-03-29T08:54:22ZRE: Anyone was able to use awssdk in a Liferay 7 moduleMarc-Andre Gauthierhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1213069712021-12-23T15:41:16Z2021-12-23T14:43:15Z<p>Thanks Olaf. </p>
<p>I was hoping you wouldn't say that :)</p>
<p>I was a bit lazy and trying to avoid loading transitive dependencies
one by one as AWS sdk has lots of them. </p>
<p>But since you confirmed that this is the case, I dig a bit more and I
found something that is working. It was a bit of a head scratcher but
maybe it will help somebody else:</p>
<ul>
<li>I created a empty maven Java project</li>
<li>Following this "how to", I exported the AWS-SDK library
as an OSGI module using the <strong>maven-bundle-plugin</strong>
from org.apache.felix <ul>
<li>The important bit is the
<Embed-Transitive>true</Embed-Transitive> in the
instructions section of the POM file</li>
<li>Ref: https://myaemlearnings.blogspot.com/2021/02/createbuild-and-install-osgi-bundle-of.html</li></ul></li>
<li>Running the "<strong>package</strong>" maven task
creates a jar file in the target directory that contains all the
required files, including transitive dependencies</li>
<li>I loaded the jar file as a OSGI module in Liferay's runtime</li>
<li>I used the following line in build.gradle of the module using the
AWS sdk <ul>
<li>runtime "software.amazon.awssdk:your.artifact.id:x.y.z"</li></ul></li></ul>
<p> </p>
<p>Notes:</p>
<ul>
<li>I exported the complete aws library using the following
"<strong>bundle</strong>" dependency so the jar file is
quite big (around 300M) <ul>
<li>
<pre>
<dependencies>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bundle</artifactId>
<version>2.17.102</version>
</dependency>
</dependencies></pre></li></ul></li>
<li>I think it would be possible to create smaller osgi modules by
exporting just parts of the SDK but I didn't try it. </li></ul>
<p>Thanks again Olaf, your comments are always helpful. </p>Marc-Andre Gauthier2021-12-23T14:43:15ZRE: Anyone was able to use awssdk in a Liferay 7 moduleOlaf Kockhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1213060942021-12-22T09:59:54Z2021-12-22T09:59:54Z<p>The problem with compileInclude is that you'll also need to make sure
transitive dependencies are available - those are the missing imports
that you see.</p>
<p>As far as I know, you can satisfy those dependencies at runtime, when
you deploy them to the OSGi runtime (in case the dependencies are OSGi
conforming bundles) or you compileInclude them as well. Or you could
avoid functions that need those transitive dependencies: Often such
APIs are offering more than you'd immediately need. But that's
apparently not the case in this situation.</p>Olaf Kock2021-12-22T09:59:54ZRE: Anyone was able to use awssdk in a Liferay 7 moduleMarc-Andre Gauthierhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1213056582021-12-22T01:18:26Z2021-12-22T01:18:26Z<p>Tried adding </p>
<p>compileInclude 'software.amazon.awssdk:s3:2.17.100' <br />
compileInclude 'software.amazon.awssdk:sdk-core:2.17.100'</p>
<p>to my build.gradle</p>
<p>Still getting loads of problems deploying module</p>
<p>Unresolved requirement: Import-Package: xyz</p>
<p>like com.google.protobuf etc.</p>Marc-Andre Gauthier2021-12-22T01:18:26ZAnyone was able to use awssdk in a Liferay 7 moduleMarc-Andre Gauthierhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1213053922021-12-21T18:49:48Z2021-12-21T18:49:48Z<p>We are trying to use Amazon AWS java sdk (1.x or2.x) in our Liferay
7.4.3.4 ga4 modu