Foren

Getting issues in module project::when adding amazonaws dependencies

Balu Bollam, geändert vor 7 Jahren.

Getting issues in module project::when adding amazonaws dependencies

New Member Beiträge: 21 Beitrittsdatum: 23.10.16 Neueste Beiträge
Hi everyone,

Iam TRying to add amazonaws dependency to liferay 7 module project.Getting errors after deploying

*I have added the following statements in the build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "io.spring.gradle:dependency-management-plugin:0.5.4.RELEASE"
}
}

apply plugin: "io.spring.dependency-management"


bundle {
includeTransitiveDependencies = true
}

dependencies {
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0"
compileOnly group: "com.liferay.portal", name: "com.liferay.util.taglib", version: "2.0.0"
compileOnly group: "javax.portlet", name: "portlet-api", version: "2.0"
compileOnly group: "javax.servlet", name: "servlet-api", version: "2.5"
compileOnly group: "jstl", name: "jstl", version: "1.2"
compileOnly group: "org.osgi", name: "org.osgi.compendium", version: "5.0.0"
compile group: 'commons-logging', name: 'commons-logging', version: '1.1.1'
compile group: 'org.apache.httpcomponents', name: 'httpclient-osgi', version: '4.3'
compile group: 'com.amazonaws', name: 'aws-java-sdk', version: '1.2.1'
compile group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.3.2'
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.0-alpha4'
}



*I have added the following in bnd.bnd
Import-Package: com.amazonaws.services.s3.AmazonS3,\
com.amazonaws.auth.AWSCredentials,\
com.amazonaws.auth.BasicAWSCredentials,\
com.amazonaws.services.s3.AmazonS3Client,\
com.amazonaws.services.s3.model.PutObjectRequest
-includeresource:\
@httpclient-osgi-4.3.jar,\
@aws-java-sdk-1.2.1.jar,\
@httpcore-4.3.2.jar,\
@commons-logging-1.1.1.jar,\
@httpclient-4.0-alpha4.jar






Getting this Error After Deploying:
org.osgi.framework.BundleException: Could not resolve module: hda_videomanager_v1 [870]_ Unresolved requirement: Import-Package: com.amazonaws.services.s3.AmazonS3_ [Sanitized]
at org.eclipse.osgi.container.Module.start(Module.java:429)
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:402)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1252)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1224)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:512)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:313)


Please anyone help me out....
Thanks in Advance
Balu
thumbnail
Milen Dyankov, geändert vor 7 Jahren.

RE: Getting issues in module project::when adding amazonaws dependencies

Expert Beiträge: 310 Beitrittsdatum: 30.10.12 Neueste Beiträge
I'm not sure what you are trying to do but what seams to happen is:
  • you are expecting a bundle to provide the com.amazonaws.services.s3.AmazonS3 package for you (stated by Import-Package: com.amazonaws.services.s3.AmazonS3)
  • there is no bundle at runtime that exports that package, thus the error.

I assume the package is inside aws-java-sdk-1.2.1.jar. If that is the case, please note:
  • you are embedding the jar file inside your bundle (stated by -includeresource)
  • as the jar will end up being embedded in a bundle and not a bundle itself, it will not export any package even if configured to do so
  • you may add the jar file to your bundle's classpath instead using Bundle-ClassPath: .,aws-java-sdk-1.2.1.jar header and remove the package from Import-Package header.


Hope this helps,
Milen
Balu Bollam, geändert vor 7 Jahren.

RE: Getting issues in module project::when adding amazonaws dependencies

New Member Beiträge: 21 Beitrittsdatum: 23.10.16 Neueste Beiträge
HI Milan,



Thanks For Your Quick reply......

Actually what iam trying to do here is....I am trying to add external jar in the module............For other jars it is working when i add compile group in gradle.properties and in bnd.bnd in Include-Resource Jar file..........That is working....But when i add aws sdk dependency in gradle.properties ,Some other jar are also adding.....So inorder to incude the transitive dependencies i am using using bundle {
includeTransitiveDependencies = true
}

Now i have tried in other way as i mentioned in the last message...

But there when i use Bundle-ClassPath: .,aws-java-sdk-1.2.1.jar

AFter building dependencies iam getting Error like aws-java-sdk-1.2.1.jar is not found...

Even this undle-ClassPath: .,lib/aws-java-sdk-1.2.1.jar ALso NOt working for me.........


please help me how to add amazonaws dependency in module project...

Thanks
Balu
thumbnail
Milen Dyankov, geändert vor 7 Jahren.

RE: Getting issues in module project::when adding amazonaws dependencies

Expert Beiträge: 310 Beitrittsdatum: 30.10.12 Neueste Beiträge
I'm not a Gradle expert by AFAIK for `includeTransitiveDependencies` to work you need `gradle-bundle-plugin`. I don't see it in your configuration and I don't see the liferay plugin (which I believe adds it) either. Make sure you have the plugin and try again. Then look inside the JAR file, find the MANIFEST.MF file and check what is generated.
Revathi Vadlamudi, geändert vor 7 Jahren.

RE: Getting issues in module project::when adding amazonaws dependencies

Junior Member Beiträge: 82 Beitrittsdatum: 14.11.14 Neueste Beiträge
Can you please tell me the solution for this as I am facing the same issue.
Emanuele Righetto, geändert vor 6 Jahren.

RE: Getting issues in module project::when adding amazonaws dependencies

New Member Beiträge: 11 Beitrittsdatum: 05.10.10 Neueste Beiträge
I would like to know the solution too, i'm facing the same issue, and this could be a great explanation on dependency management with osgi.
Thanks
thumbnail
Joye Luo, geändert vor 6 Jahren.

RE: Getting issues in module project::when adding amazonaws dependencies

Regular Member Beiträge: 144 Beitrittsdatum: 03.05.16 Neueste Beiträge
Hey Emanuele,

You can use compileInclude for the third party libraries.
Here is the tutorial link:
https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/adding-third-party-libraries-to-a-module

Hope that can resolve your problem.