On 2024/06/11 14:15:48 Rémy Maucherat wrote: > Hi, > > To fix the issue with having Java 22 classes in tomcat-coyote (and > embedded), I was looking at multi release JARs. I think it would work > fine *if* we were building the JARs ourselves (jarIt task), but then > the jars are actually rebuilt with bnd. > > Supposedly bnd 7.0.0 (which we just upgraded to) supports multi > release jars. After looking at their testsuite, it seems adding > "Multi-release: true" to the bnd and having the classes in the right > spot (META-INF/versions/22) would be enough [see: > https://github.com/bndtools/bnd/pull/5581/files ]. Unfortunately, this > keeps doing nothing for me. If anyone can get it to work, let me know.
I looked at this more closely. That example above I have applied some time with Robert Scholte to my project with Maven [1]. It does work flawlessly. The BND tool for Ant is rather limited. What will work for you is the following: * Add the flag: > $ git diff -U0 > diff --git a/res/META-INF/default.manifest b/res/META-INF/default.manifest > index 8937c41931..87919e7dee 100644 > --- a/res/META-INF/default.manifest > +++ b/res/META-INF/default.manifest > @@ -9,0 +10 @@ X-Compile-Target-JDK: @target.jdk@ > +Multi-Release: true * Add a separate compilation step for the FFM stuff with a different --release option to a separate dir. Update the packaging of the JAR with META-INF/versions/22 and fill with those classes. That will work. But beware, BND generates a module-info.class for the root code. What if the versioned one needs another module-info.class? What if the OSGi metadata need to be different for the FFM code? There is no versioned MANIFEST.MF. If this is not a problem it will do for you. For me it does: $ curl -sL https://search.maven.org/remotecontent?filepath=net/sf/michael-o/activedirectory-dns-locator/0.4.0/activedirectory-dns-locator-0.4.0.jar | tar tzf - META-INF/ META-INF/MANIFEST.MF META-INF/LICENSE.txt META-INF/services/ META-INF/services/com.sun.jndi.ldap.spi.LdapDnsProvider META-INF/services/javax.naming.ldap.spi.LdapDnsProvider META-INF/versions/ META-INF/versions/12/ META-INF/versions/12/net/ META-INF/versions/12/net/sf/ META-INF/versions/12/net/sf/michaelo/ META-INF/versions/12/net/sf/michaelo/activedirectory/ META-INF/versions/12/net/sf/michaelo/activedirectory/ActiveDirectoryLdapDnsProvider.class net/ net/sf/ net/sf/michaelo/ net/sf/michaelo/activedirectory/ net/sf/michaelo/activedirectory/ActiveDirectoryDnsLocator$1.class net/sf/michaelo/activedirectory/ActiveDirectoryDnsLocator$Builder.class net/sf/michaelo/activedirectory/ActiveDirectoryDnsLocator$HostPort.class net/sf/michaelo/activedirectory/ActiveDirectoryDnsLocator$SrvRecord.class net/sf/michaelo/activedirectory/ActiveDirectoryDnsLocator.class net/sf/michaelo/activedirectory/ActiveDirectoryLdapDnsProvider.class ... Michael [1] https://github.com/michael-o/activedirectory-dns-locator/blob/main/pom.xml --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org