[JAVA-4836] AWS dependency should be set as optional in Import-Package Created: 08/Jan/23  Updated: 28/Oct/23  Resolved: 11/Jan/23

Status: Closed
Project: Java Driver
Component/s: Packaging
Affects Version/s: 4.8.0
Fix Version/s: 4.8.2

Type: Bug Priority: Minor - P4
Reporter: Tomáš Toka Mrázek Assignee: Jeffrey Yemin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
is caused by JAVA-4718 Depend on AWS SDK for fetching creden... Closed

 Description   

OSGi mafinest does not have optional configuration for package com.amazonaws.auth.

In /driver-core/build.gradle, afterEvaluate should have line

com.amazonaws.*;resolution:=optional',



 Comments   
Comment by Githook User [ 11/Jan/23 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Add OSGi package imports for AWS SDK v1 and v2 (#1065)

JAVA-4836
Branch: 4.8.x
https://github.com/mongodb/mongo-java-driver/commit/ea09d64399869da5009b5032213deddb67c3ee4d

Comment by Githook User [ 11/Jan/23 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Add OSGi package imports for AWS SDK v1 and v2 (#1065)

JAVA-4836
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/f0e400b1764c39df234b0531a338a06bd17c289a

Comment by Tomáš Toka Mrázek [ 11/Jan/23 ]

Looks like it works as expected.

Comment by Jeffrey Yemin [ 11/Jan/23 ]

A manual test would be fantastic. Thank you for the offer.

Comment by Tomáš Toka Mrázek [ 11/Jan/23 ]

Explicitly specifying packages in Import-Package basically overrides any automatic resolution for that package, that's why there is no version.

According to OSGi spec no version specified means every version.

 

A version-range to select the exporter's package version. The syntax must follow Version Ranges. For more information on version selection, see Semantic Versioning. If this attribute is not specified, it is assumed to be [0.0.0, ∞). 

There's been some discussion in BND here to rather use DynamicImport-Package instead of optional packages, but I'd say it's ok as it is, since majority of libraries use the same principle. Besides on the official BND FAQ 42.4 there is used the same exact solution as proposed in your PR.

I may test it manually in our OSGi environment before merge, if you wish. It's currently hacked via exporting packages through system bundle.

 

Comment by Jeffrey Yemin [ 10/Jan/23 ]

Hi mongodb@tomastokamrazek.cz

I put a fix in code review here and posed a question in the description about the lack of a version range for either of the packages. Can you let me know if you think that will cause a problem?

Thanks,
Jeff

Comment by Jeffrey Yemin [ 09/Jan/23 ]

Note that AWS jars do not include OSGi package import/export metadata in their own MANIFEST.MF files.

Comment by Tomáš Toka Mrázek [ 09/Jan/23 ]

Oh and this package is also required.

software.amazon.awssdk.auth.credentials

Generated at Thu Feb 08 09:03:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.