Skip to content

Commit c4ef785

Browse files
authored
Merge pull request bndtools#6765 from chrisrueger/fix-wording
wording: Imports that lack version ranges
2 parents bec9e66 + 5411c30 commit c4ef785

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

biz.aQute.bndlib/src/aQute/bnd/osgi/Analyzer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2129,8 +2129,8 @@ && complainAboutMissingVersionRange(packageRef, ee)) {
21292129

21302130
if (isPedantic() && noimports.size() != 0) {
21312131
warning(
2132-
"Imports that lack version ranges due to not being found in any bundle on the -buildpath: %s (These could stem from transitive dependencies of non-OSGi jars in your classpath (e.g. from -includeresource). "
2133-
+ "Adding this dependency to your -buildpath could help bnd adding version information.)",
2132+
"Imports that lack version ranges due to not being found in any bundle on the -buildpath: %s (These could stem from transitive dependencies of the jars on your buildpath (e.g. by wrapping non-OSGi jars via -includeresource or if Require-Bundle is involved)."
2133+
+ "Explicitly adding these dependencies to your -buildpath could help bnd find the correct version information.)",
21342134
noimports);
21352135
}
21362136
}

docs/_chapters/920-faq.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ A usually better way is to make the imports optional:
5050

5151
Note the end at the Import-Package statement, that wildcard '*' is crucial for remaining imports, see [No Imports Show Up](?#noImports).
5252

53-
## No Imports Show Up <a name="noImports"/>
53+
## No Imports Show Up
5454
The imports that show up in your Import-Package manifest header are controlled by the bnd file's Import-Package instruction. In bnd, the list is a set of patterns that are sequentially applied to your imports as calculated by bnd from the classes, resources, and headers in the JAR.
5555

5656
The default Import-Package bnd instruction is:
@@ -69,6 +69,19 @@ Another reason is the exclude operator ('!') that will remove imports. If this i
6969

7070
Last but not least, look at the `[USEDBY]` section of the JAR print out, make sure there are actually references.
7171

72+
## Why do I have imports without version ranges?
73+
74+
With `-pedantic:true` bnd creates a warning like
75+
76+
> Imports that lack version ranges due to not being found in any bundle on the -buildpath: `com.example.foo.bar` ...
77+
78+
These could stem from transitive dependencies of the jars on your buildpath.
79+
There are multiple reasons for that, for example they could stem from transitive dependencies:
80+
- of non-OSGi jars which are included via [-includeresource](/instructions/includeresource.html)
81+
- of OSGi bundles on your classpath, if the import version ranges for those bundles are not specified in the Bundle. E.g. if the bundle imports the dependency via `Require-Bundle` it won't have the import range, or if it uses `Import-Package` with no import range.
82+
83+
84+
7285
## Why No Automatic Bundle-Activator <a name="automaticActivator"/>
7386
Many people are surprised that bnd does not automatically calculate the Bundle-Activator. Basically, there are the following issues:
7487

0 commit comments

Comments
 (0)