Conversation
The features service linked directly against org.ops4j.pax.url.mvn, plus
ops4j-base and pax-swissbox for property resolution. That made Pax URL a hard
dependency of the core provisioning path and blocked assembling a distribution
without it.
Introduce org.apache.karaf.features.spi, a Karaf owned resolver contract
(MavenResolver, MavenResolverFactory, MavenResolvers), and consume it
everywhere the features service resolves mvn: URIs. Providers are discovered as
an OSGi service inside the framework and with ServiceLoader outside it, so the
assembly builder and the karaf-maven-plugin keep working unchanged.
The Pax URL binding moves to a new bundle, org.apache.karaf.maven.resolver.paxurl,
which registers a MavenResolverFactory and a MavenResolver built lazily from the
org.ops4j.pax.url.mvn PID. It ships in the standard distribution at start level
14, so behaviour and configuration are unchanged; it is now the only bundle in
the boot set that imports org.ops4j.pax.url.
The features Activator declares the factory with @RequireService, so the
features service simply waits for a provider instead of building a resolver
itself - no new startup ordering machinery.
Property resolution in FeaturesProcessingSerializer no longer uses ops4j-base
and pax-swissbox. PropertyResolver and PropertySubstitutor reimplement the
semantics the serializer relies on: system properties take precedence over the
supplied dictionary, blank means absent, and unresolved ${...} placeholders are
left untouched so the existing warning still fires. Malformed placeholders are
now kept verbatim rather than raising EmptyStackException.
org.apache.karaf.features.core and org.apache.karaf.features.command no longer
have any org.ops4j dependency, import or private package.
Relates to apache#2212
Test Results 522 files - 204 522 suites - 204 10m 1s ⏱️ - 1h 5m 19s For more details on these errors, see this check. Results for commit 86564e0. ± Comparison against base commit a110f75. This pull request removes 210 and adds 2 tests. Note that renamed tests count towards both. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
org.apache.karaf.features.corelinked directly againstorg.ops4j.pax.url.mvn, and usedops4j-base+pax-swissboxfor property resolution. That made Pax URL a hard dependency of the core provisioning path, so a distribution without Pax URL was not possible and the resolver could not be refactored independently.This removes that coupling without changing anything users see. Pax URL stays in the standard distribution, same bundle, same configuration, same behaviour.
Relates to #2212.
What
A Karaf owned resolver contract —
org.apache.karaf.features.spi, exported by features core:Providers are found as an OSGi service inside the framework, and with
ServiceLoaderoutside it, so the assemblyBuilderand thekaraf-maven-pluginkeep working unchanged.The Pax URL binding moved out into a new bundle,
org.apache.karaf.maven.resolver.paxurl. It registers aMavenResolverFactoryand aMavenResolverbuilt lazily from theorg.ops4j.pax.url.mvnPID, so it does not have to wait for ConfigAdmin and configuration changes made before the first resolution are still picked up. It ships in the framework feature at start level 14.No new startup ordering machinery. The features Activator already declared its requirements, so the factory is just another
@RequireService:BaseActivatorholdsdoStart()until a provider is present. All three requirements are Karaf or OSGi contracts — none names Pax URL.Property resolution in
FeaturesProcessingSerializerno longer usesops4j-base/pax-swissbox.PropertyResolverandPropertySubstitutorreimplement the semantics the serializer depends on: system properties take precedence over the supplied dictionary, blank means absent, and unresolved${...}are left untouched so the existing warning still fires.The unused
tinybundlestest dependency is dropped, andfeature:export-bundlesnow consumes theMavenResolverservice the provider registers.Result
org.apache.karaf.features.coreandorg.apache.karaf.features.commandhave noorg.ops4jdependency, import or private package. Across the whole boot set, exactly one bundle importsorg.ops4j.pax.url:A Pax URL free distribution now only needs a bundle registering a
MavenResolverFactoryand anmvn:URLStreamHandlerService, plus a framework feature that lists it instead ofpax-url-aether+resolver-paxurl. Nothing in the features service has to change.Behaviour changes
Two, both in previously broken paths:
${...}placeholders inorg.apache.karaf.features.xmlare kept verbatim instead of raisingEmptyStackException. Well formed input never reaches that path.ReactorMavenResolverimplements 3 methods instead of 9 and usesorg.apache.karaf.util.maven.Parserrather than the Pax URL internal one.Optional dependencies are not transitive, so
profile,karaf-maven-pluginanditests/testnow declare explicitly what they used to inherit from features core.Testing
mvn:org.ops4j.pax.url/pax-url-wrap/3.0.3/jar/uber.etc/startup.propertiesconfirms the layering: