bnd icon indicating copy to clipboard operation
bnd copied to clipboard

"Contracts [...] declare the same packages in their uses " due to transitive Maven dependency

Open kwin opened this issue 5 years ago • 3 comments

Some bundles embed/include the contents of other bundles. That also includes the OSGi contracts which would need to be repeated on the embedding bundle's manifest. Still depending on the to be embedded bundle b with scope "compile" (i.e. transitively visible) in the embedding bundle a leads to an error message like this when depending on the embedding bundle a

Contracts [Contract [name=...;version=...;from=a], Contract [name=...:version=...;from=b]] declare the same packages in their uses: directive: [...]. Contracts are found in declaring bundles (see their 'from' field), it is possible to control the findingwith the -contract instruction

Although this error could be prevented by a not having b as dependency with scope compile but provided but still this should not lead to an error but only a warn (and the first contract from the classpath should win).

For a concrete use case look at https://github.com/apache/sling-org-apache-sling-commons-johnzon and https://issues.apache.org/jira/browse/SLING-9218.

kwin avatar Mar 19 '20 20:03 kwin

@rotty3000 Do you agree that this error message is wrong in this case?

kwin avatar Apr 15 '20 19:04 kwin

at first glace your argument sounds correct. But we'll have to check it.

rotty3000 avatar Apr 16 '20 18:04 rotty3000

I wonder if this is resolvable by the more recently added instruction -define-contract

rotty3000 avatar Aug 27 '21 14:08 rotty3000

This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. If you feel this is something you could contribute, please have a look at our Contributor Guide. Thank you for your contribution.

github-actions[bot] avatar Nov 13 '22 03:11 github-actions[bot]

This issue has been automatically closed due to inactivity. If you can reproduce this on a recent version of Bnd/Bndtools or if you have a good use case for this feature, please feel free to reopen the issue with steps to reproduce, a quick explanation of your use case or a high-quality pull request.

github-actions[bot] avatar Dec 05 '22 02:12 github-actions[bot]