Repository navigation
feat(features): decouple features service from Pax URL - #2928
Merged
Merged
Conversation
CptBartender
reviewed
Oct 5, 2026
CptBartender
reviewed
Oct 5, 2026
Member
Author
|
FYI, I also updated the manual/documentation to mention the resolver. |
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
…/download/impl/LocalMavenResolver.java Co-authored-by: CptBartender <fryderyk.wysocki@gmail.com>
…olver The features service calls resolve(url, previousException) for every attempt, with a null exception for the first one. Providing a default implementation delegating to resolve(url) means a resolver that has no use for the previous failure does not have to override it.
jbonofre
force-pushed
the
feature/decouple-pax-url-spi
branch
from
October 16, 2026 08:25
43bbcb1 to
8484c78
Compare
Boot repositories no longer require a mvn URL handler to be registered, which made the features service race with Pax URL at startup.
jbonofre
added a commit
to jbonofre/karaf
that referenced
this pull request
Nov 13, 2026
- Add the Maven resolver bundle to framework-light, as in framework (apache#2928) - Keep the file handler at ALL so logger specific levels reach karaf.log - Keep strong references to the configured JUL loggers, reset the removed ones - Interpolate placeholders in etc/org.apache.karaf.logging.cfg and apply the file settings on configuration update - Roll karaf.log over by size (10MB, 5 backups by default), keeping the active file name - Register LogReaderService as a ServiceFactory to remove the listeners of a bundle when it releases the service - Isolate the ManagedService as org.osgi.service.cm is an optional import - Always log AUDIT entries - Disable console output by default (karaf.log.console), log bundle events at DEBUG - Use Karaf level names in the log format, slf4j.version in the exports, remove jansi from the light frameworks - Document the light logging service
jbonofre
added a commit
to jbonofre/karaf
that referenced
this pull request
Nov 16, 2026
- Add the Maven resolver bundle to framework-light, as in framework (apache#2928) - Keep the file handler at ALL so logger specific levels reach karaf.log - Keep strong references to the configured JUL loggers, reset the removed ones - Interpolate placeholders in etc/org.apache.karaf.logging.cfg and apply the file settings on configuration update - Roll karaf.log over by size (10MB, 5 backups by default), keeping the active file name - Register LogReaderService as a ServiceFactory to remove the listeners of a bundle when it releases the service - Isolate the ManagedService as org.osgi.service.cm is an optional import - Always log AUDIT entries - Disable console output by default (karaf.log.console), log bundle events at DEBUG - Use Karaf level names in the log format, slf4j.version in the exports, remove jansi from the light frameworks - Document the light logging service
jbonofre
added a commit
that referenced
this pull request
Nov 17, 2026
#2949) * Add lightweight karaf-logging service and use it in apache-karaf-light - Introduce org.apache.karaf.services.logging delegating to java.util.logging (JUL) - Export OSGi LogService R7, SLF4J 2.x/1.7.x, and Commons Logging 1.2 - Provide framework-light and static-framework-light feature definitions - Update karaf-maven-plugin to support framework-light and static-framework-light - Configure apache-karaf-light distribution to use framework-light and karaf-logging instead of Pax Logging * Fix karaf-logging review findings - Add the Maven resolver bundle to framework-light, as in framework (#2928) - Keep the file handler at ALL so logger specific levels reach karaf.log - Keep strong references to the configured JUL loggers, reset the removed ones - Interpolate placeholders in etc/org.apache.karaf.logging.cfg and apply the file settings on configuration update - Roll karaf.log over by size (10MB, 5 backups by default), keeping the active file name - Register LogReaderService as a ServiceFactory to remove the listeners of a bundle when it releases the service - Isolate the ManagedService as org.osgi.service.cm is an optional import - Always log AUDIT entries - Disable console output by default (karaf.log.console), log bundle events at DEBUG - Use Karaf level names in the log format, slf4j.version in the exports, remove jansi from the light frameworks - Document the light logging service * Fix second karaf-logging review findings - Copy and truncate karaf.log when it can't be renamed on roll over (on Windows, the Karaf Main bootstrap log handlers keep it open), and report a failed roll over once instead of retrying it for each record - Return the most recent log entry first in LogReaderService.getLog() - Include the Karaf logging service file in dev:dump-create, without creating an empty Pax Logging configuration - Restore the default logging configuration when it's deleted - Use the Karaf logging configuration in the instances created from an Apache Karaf Light root instance - Name the LogService logger after the calling bundle and keep the level given to the LogService in LogEntry.getLevel(), like Pax Logging - Support nested placeholders in the default values - Don't export org.osgi.service.log.admin as no LoggerAdmin is registered * Address third karaf-logging review findings - Fall back to org.apache.karaf.services.logging in InstanceServiceImpl.restartInstance and bin/instance(.bat), bin/shell(.bat) when pax-logging-api is absent - Guard against null processed properties and empty/non-regular file paths in LogDumpProvider - Handle null logger names in LogServiceImpl.getLogger, avoid per-event LogServiceImpl allocation in Activator, use CopyOnWriteArrayList.addIfAbsent in LogReaderServiceImpl, and remove KarafLogHandler ThreadLocal in finally - Drop redundant SLF4J dependency versions already managed in karaf-bom * Address remaining karaf-logging review items - Extract trailing ServiceReference and Throwable in OsgiLoggerImpl per OSGi R7 Log spec - Map Logger.ROOT_LOGGER_NAME to JUL root logger in LogServiceImpl - Skip copying unused etc/org.apache.karaf.log.cfg when creating child instances from a Karaf logging root instance * Fix Windows restart classpath and address full karaf-logging review - InstanceServiceImpl: use String.replace() to build the system/ path, replaceAll() with File.separator as replacement fails on Windows ("character to be escaped is missing") - InstanceServiceImpl: look for jline under org.jline (system/org/jline), the root instance restart always failed to find it - InstanceServiceImpl: decide the child instance logging configuration from the root startup.properties (which the child uses) instead of the presence of etc/org.apache.karaf.logging.cfg - shell.bat/instance.bat: quote the CLASSPATH assignments in the if blocks, a ')' in KARAF_HOME (C:\Program Files (x86)) ended the block - JulConfig: reset the LogManager like Pax Logging does, so the Karaf Main bootstrap log handlers don't write Main records twice to karaf.log - KarafLogHandler: format the LogEntry message with Formatter.formatMessage like karaf.log (MessageFormat only applied with {n} placeholders) - log.adoc: document the Pax Logging blacklist and cleanup needed when using framework-light in a custom distribution * Fix FileCompleter path separator replacement on Windows replaceAll() treats its replacement as a regex replacement string, where the Windows File.separator ("\") is an escape character: completing a path containing "/" failed with "character to be escaped is missing".
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: