<plugin>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>filevault-package-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<group>com.myproject.aem</group>
<packageType>container</packageType>
<!-- skip sub package validation for now as some vendor packages like CIF apps will not pass -->
<skipSubPackageValidation>true</skipSubPackageValidation>
<embeddeds>
<embedded>
<groupId>com.myproject.aem</groupId>
<artifactId>aem-myproject.ui.apps</artifactId>
<type>zip</type>
<target>/apps/myproject-packages/application/install</target>
</embedded>
<embedded>
<groupId>com.myproject.aem</groupId>
<artifactId>aem-myproject.core</artifactId>
<target>/apps/myproject-packages/application/install</target>
</embedded>
<embedded>
<groupId>com.myproject.aem</groupId>
<artifactId>aem-myproject.ui.config</artifactId>
<type>zip</type>
<target>/apps/myproject-packages/application/install</target>
</embedded>
<embedded>
<groupId>com.myproject.aem</groupId>
<artifactId>aem-myproject.ui.content</artifactId>
<type>zip</type>
<target>/apps/myproject-packages/content/install</target>
</embedded>
<!-- external jar-->
<embedded>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-sdk-java</artifactId>
<target>/apps/myproject-packages/application/install</target>
</embedded>
</embeddeds>
</configuration>
</plugin>
Added aws-sdk-java dependency in <project>\all module as below
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-sdk-java</artifactId>
</dependency>
Added below in dependency in parent module
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-sdk-java</artifactId>
<version>2.19.33</version>
<scope>provided</scope>
</dependency>
I have refered below articles -
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @Mario248 ,
I think you need to create an OSGi bundle of the non-OSGi JAR dependencies, you can do it using the maven-bundle-plugin where you would also need to set the export as well.
Check the below article, it has a similar use case as yours.
https://myaemlearnings.blogspot.com/2021/08/embedding-third-party-dependencyosgi.html
Hope that helps!
Regards,
Nitesh
Hi @Mario248
The above steps look fine but I didn't see the dependency used in the core module where you want to use the corresponding classes. You might need to add the dependency in the core module pom.xml along with the parent pom.
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-sdk-java</artifactId>
</dependency>
Also, If you still see the issue, can you share the screenshot of the system/console/bundle where we can see the error?
Regards,
Arpit Varshney
I have already adde this in core module dependency. Sorry, I forgot to mention this before.
I see below error while deploying to AEM,
@Mario248 It seems like the jar you mentioned above is depending on this jar which is not resolving as a bundle. Could you please add this jar as well in all/pom.xml like the one you mentioned in the problem statement and follow the same steps for this one and see if it works?
Regards,
Arpit Varshney
Please check example here
I already used <embedded> to include external jar except <type> attribute. I guess the default value is jar if we dont provide.
software.amazon.awssdk.auth.credentials is a jar or a bundle? if it is a jar then it will not be resolved in aem.
Thanks for your response. I am aware that Bundle-SymbolicName
header in the MANIFEST.MF tells whether it is jar or bundle. I found that it is not osgi bundle it is just plain jar file. below is the manifest file
Manifest-Version: 1.0
Automatic-Module-Name: software.amazon.awssdk.awscore
Build-Jdk-Spec: 1.8
Created-By: Maven JAR Plugin 3.3.0
Can you tell me how we should install this jar file(https://mvnrepository.com/artifact/software.amazon.awssdk/aws-core/2.20.2) in AEM?
you need to convert jar to a bundle and host at your own artifact repository/project and then add as dependency
Thanks. Just want to understand this thing, I have around 40+ dependencies in
dependencies with provided/test scope are used during build/test, so does not matter if they are bundle or jar
but if you are deploying in jar in AEM webconsole must be a bundle.
Great, Thank you for the explanation. In my case I want to use this jar as provided if I am correct.
Basically I want to import few classes from this jar and have below logic
Imports
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.sns.SnsClient;
import software.amazon.awssdk.services.sns.model.CreateTopicRequest;
import software.amazon.awssdk.services.sns.model.CreateTopicResponse;
import software.amazon.awssdk.services.sns.model.SnsException;
Code
public static String createSNSTopic(SnsClient snsClient, String topicName ) {
CreateTopicResponse result = null;
try {
CreateTopicRequest request = CreateTopicRequest.builder()
.name(topicName)
.build();
result = snsClient.createTopic(request);
return result.topicArn();
} catch (SnsException e) {
System.err.println(e.awsErrorDetails().errorMessage());
System.exit(1);
}
return "";
}
Reference - https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/examples-simple-notification-service...
I have already added below thing in my parent POM, as below(same as original question)
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-sdk-java</artifactId>
<version>2.19.33</version>
<scope>provided</scope>
</dependency>
I don't need to install this in Felix console, I can use it directly, right?
if you want to execute your code in AEM then you need this jar in Felix.
provide is used when container(Felix console) already(OOTB/manually installed) have the jar
Hi @Mario248 ,
If you are stuck with JAR which you want as bundle then you can just convert the JAR to bundle and then use it. Please refer below video-
Thanks
Ritesh Mittal
Hi @Mario248 ,
I think you need to create an OSGi bundle of the non-OSGi JAR dependencies, you can do it using the maven-bundle-plugin where you would also need to set the export as well.
Check the below article, it has a similar use case as yours.
https://myaemlearnings.blogspot.com/2021/08/embedding-third-party-dependencyosgi.html
Hope that helps!
Regards,
Nitesh