On 10/11/2022 9:18 AM, Mark Thomas wrote:
On 11/10/2022 16:36, Garret Wilson wrote:
…
* The primary build generates JPMS and OSGI metadata, so some classes
are annotated with the bnd annotation
`aQute.bnd.annotation.spi.ServiceConsumer`. Currently this
annotation come from `biz.aQute.bnd:biz.aQute.bnd.annotation:6.3.1`.
Not quite. Tomcat gets it from:
biz.aQute.bnd:biz.aQute.bnd:6.3.1
Perhaps that's where Tomcat gets it from. The library you mentioned
seems to be some sort of an aggregate distribution of various libraries,
perhaps to be used in an environment such as Ant that doesn't know how
to go download transitive dependencies. The same class appears in the
`biz.aQute.bnd:biz.aQute.bnd.annotation:6.3.1`.
…
* The `aQute.bnd.annotation.spi.ServiceConsumer` annotation uses the
OSGi annotation `org.osgi.annotation.bundle.Requirement`. Currently
this annotation comes from `org.osgi:osgi.annotation:8.1.0`.
This is incorrect. bnd no longer depends on the OSGi JAR.
I believe what I said was correct: the
`aQute.bnd.annotation.spi.ServiceConsumer` annotation uses the OSGi
annotation `org.osgi.annotation.bundle.Requirement`. You can see this
even in the `ServiceConsumer` source code for the
`biz.aQute.bnd:biz.aQute.bnd:6.3.1` you mentioned:
```java
import org.osgi.annotation.bundle.Directive;
import org.osgi.annotation.bundle.Requirement;
…
@Requirement(name = VALUE_MACRO, namespace = SERVICELOADER_NAMESPACE,
attribute = {
SERVICELOADER_NAMESPACE + "=" + VALUE_MACRO, CARDINALITY_MACRO,
RESOLUTION_MACRO
})
```
And even at
https://search.maven.org/artifact/biz.aQute.bnd/biz.aQute.bnd/6.3.1/jar
you can see that `biz.aQute.bnd:biz.aQute.bnd:6.3.1` declares
dependencies on various OSGi artifacts. Perhaps in the primary Tomcat
build, as Ant doesn't know how to pull down transitive dependencies, you
never noticed that `biz.aQute.bnd:biz.aQute.bnd:6.3.1` relies on the
OSGi libraries.
I'm not saying your build requires them; I'm simply saying that the
source bnd source code uses them. If I include on the bnd libraries and
not the OSGi libraries, `javac` tells me things such as:
> [WARNING] Cannot find annotation method 'value()' in type
> 'org.osgi.annotation.bundle.Requirements': class file for
org.osgi.annotation.bundle.Requirements not found
I believe that the combination of dependencies I indicated includes the
same classes required to prevent the warning without needing to include
this larger "aggregate" artifact `biz.aQute.bnd:biz.aQute.bnd:6.3.1`.
* Thus any secondary Maven builds need to inform Maven that it can
download the bnd and OSGI annotations just to make sure that no
classes are missing during this secondary build process, but that
these artifacts are not needed at runtime and should not be
distributed in the resulting JAR. In Maven this is easily indicated
uses the `provided` scope.
This is not correct either. What you term secondary builds do not
require bnd in order to compile against the Tomcat JARs.
I would quibble that I didn't say it was required; I said it was needed
if you want to tell Maven that the classes aren't really missing and
aren't needed at runtime.
This would not negatively affect Tomcat one bit, yet it would
arguably provide "more complete information" for any secondary builds.
The negative impact is that all users of that JAR would be required to
download the bnd library to compile their project for no benefit to them.
I understand your point of view, and I sincerely appreciate your
spending valuable time in discussing this.
Cheers,
Garret
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org