You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by "jbonofre (via GitHub)" <gi...@apache.org> on 2026/09/20 18:53:58 UTC
[PR] feat(features): decouple features service from Pax URL [karaf]
jbonofre opened a new pull request, #2928:
URL: https://github.com/apache/karaf/pull/2928
## Why
`org.apache.karaf.features.core` linked directly against `org.ops4j.pax.url.mvn`, and used `ops4j-base` + `pax-swissbox` for 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:
```java
public interface MavenResolver extends Closeable {
enum RetryChance { NEVER, LOW, HIGH, UNKNOWN }
File resolve(String url) throws IOException;
File resolve(String url, Exception previousException) throws IOException;
default File resolve(String groupId, String artifactId, String classifier,
String extension, String version) throws IOException { ... }
default RetryChance isRetryableException(Exception exception) { ... }
}
public interface MavenResolverFactory {
String getConfigurationPid();
MavenResolver create(Dictionary<String, String> configuration, String propertyPrefix);
}
```
Providers are found 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 moved out** into a new bundle, `org.apache.karaf.maven.resolver.paxurl`. It registers a `MavenResolverFactory` and a `MavenResolver` built lazily from the `org.ops4j.pax.url.mvn` PID, 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`:
```
org.apache.karaf.features.spi.MavenResolverFactory=
org.osgi.service.cm.ConfigurationAdmin=
org.osgi.service.url.URLStreamHandlerService=(url.handler.protocol\=mvn)
```
`BaseActivator` holds `doStart()` until a provider is present. All three requirements are Karaf or OSGi contracts — none names Pax URL.
**Property resolution** in `FeaturesProcessingSerializer` no longer uses `ops4j-base` / `pax-swissbox`. `PropertyResolver` and `PropertySubstitutor` reimplement 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 `tinybundles` test dependency is dropped, and `feature:export-bundles` now consumes the `MavenResolver` service the provider registers.
## Result
`org.apache.karaf.features.core` and `org.apache.karaf.features.command` have no `org.ops4j` dependency, import or private package. Across the whole boot set, exactly one bundle imports `org.ops4j.pax.url`:
```
IMPORTS pax.url -> org.apache.karaf.maven.resolver.paxurl
```
A Pax URL free distribution now only needs a bundle registering a `MavenResolverFactory` and an `mvn:` `URLStreamHandlerService`, plus a framework feature that lists it instead of `pax-url-aether` + `resolver-paxurl`. Nothing in the features service has to change.
## Behaviour changes
Two, both in previously broken paths:
- Malformed `${...}` placeholders in `org.apache.karaf.features.xml` are kept verbatim instead of raising `EmptyStackException`. Well formed input never reaches that path.
- `ReactorMavenResolver` implements 3 methods instead of 9 and uses `org.apache.karaf.util.maven.Parser` rather than the Pax URL internal one.
Optional dependencies are not transitive, so `profile`, `karaf-maven-plugin` and `itests/test` now declare explicitly what they used to inherit from features core.
## Testing
- Full reactor build green.
- Unit tests green: features core (139), features command (16), profile (13), karaf-maven-plugin (24).
- The assembled distribution boots, the features service starts, and boot features are provisioned through the new path, including resolving and installing `mvn:org.ops4j.pax.url/pax-url-wrap/3.0.3/jar/uber`.
- Generated `etc/startup.properties` confirms the layering:
```
mvn:org.ops4j.pax.url/pax-url-aether/3.0.3 = 5
mvn:org.apache.karaf.maven/org.apache.karaf.maven.resolver.paxurl = 14
mvn:org.apache.karaf.features/org.apache.karaf.features.core = 15
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@karaf.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(features): decouple features service from Pax URL [karaf]
Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre merged PR #2928:
URL: https://github.com/apache/karaf/pull/2928
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@karaf.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(features): decouple features service from Pax URL [karaf]
Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on PR #2928:
URL: https://github.com/apache/karaf/pull/2928#issuecomment-6010171239
FYI, I also updated the manual/documentation to mention the resolver.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@karaf.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(features): decouple features service from Pax URL [karaf]
Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on code in PR #2928:
URL: https://github.com/apache/karaf/pull/2928#discussion_r4191867490
##########
features/core/src/main/java/org/apache/karaf/features/internal/download/impl/LocalMavenResolver.java:
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.features.internal.download.impl;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import org.apache.karaf.features.spi.MavenResolver;
+import org.apache.karaf.util.maven.Parser;
+
+/**
+ * Resolves Maven coordinates from the Karaf distribution's local system repository only.
+ */
+public class LocalMavenResolver implements MavenResolver {
+
+ private final Path systemRepository;
+
+ public LocalMavenResolver(Path systemRepository) {
+ this.systemRepository = systemRepository.toAbsolutePath().normalize();
+ }
+
+ /**
+ * Create a resolver for the repository configured by the running Karaf distribution.
+ *
+ * @return a resolver rooted at {@code karaf.home/karaf.default.repository}.
+ */
+ public static LocalMavenResolver forKarafSystem() {
+ Path home = Paths.get(System.getProperty("karaf.home", "karaf"));
+ Path repository = Paths.get(System.getProperty("karaf.default.repository", "system"));
+ if (!repository.isAbsolute()) {
+ repository = home.resolve(repository);
+ }
+ return new LocalMavenResolver(repository);
+ }
+
+ @Override
+ public File resolve(String url) throws IOException {
+ if (url == null || !url.startsWith("mvn:")) {
+ throw new MalformedURLException("Expected a mvn: URI: " + url);
+ }
+ String artifactPath = Parser.pathFromMaven(url);
+ Path artifact = systemRepository.resolve(artifactPath).normalize();
+ if (!artifact.startsWith(systemRepository)) {
+ throw new IOException("Maven artifact path is outside the Karaf system repository: " + url);
+ }
+ if (!artifact.toFile().isFile()) {
+ throw new FileNotFoundException("Maven artifact " + url + " was not found in the Karaf system repository "
+ + systemRepository);
+ }
+ return artifact.toFile();
+ }
+
+ @Override
+ public File resolve(String url, Exception previousException) throws IOException {
+ return resolve(url);
Review Comment:
`resolve(url, previousException)` is not a retry-only method. It is the entry point the download path uses for every attempt:
- first attempt: `MavenDownloadTask.download()` calls `resolver.resolve(url, previousException)` with `previousException = null`. Throwing there would make the Pax URL free fallback resolve nothing at all.
- retries: because `isRetryableException` returns `NEVER`, `AbstractRetryableDownloadTask` sets the retry count to 0 and never reachable. A guard on a non-null `previousException` would be dead code.
- contract: the SPI Javadoc descriobes the exception as a hint the implementation may use, so ignoring it is legitimate.
I understand your confusion though, because the SPI has two abstract `resolve` methods where on would do. `LocalMavenResolver` and the stub in `TestMavenResolverFactory` both carry the same `return resolve(url);` boilerplate.
I would make the hint overload a default method in `MavenResolver` that delegates to `resolve(url)`, as `resolve(g, a, c, e, v)` and `isRetryableException` already are. The Pax URL, lazy and reactor resolvers keep their overrides, and the line you commented on disappears. The SPI is new in this PR, so this is the cheapest time to change it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@karaf.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(features): decouple features service from Pax URL [karaf]
Posted by "CptBartender (via GitHub)" <gi...@apache.org>.
CptBartender commented on code in PR #2928:
URL: https://github.com/apache/karaf/pull/2928#discussion_r4187846218
##########
features/core/src/main/java/org/apache/karaf/features/internal/download/impl/LocalMavenResolver.java:
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.features.internal.download.impl;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import org.apache.karaf.features.spi.MavenResolver;
+import org.apache.karaf.util.maven.Parser;
+
+/**
+ * Resolves Maven coordinates from the Karaf distribution's local system repository only.
+ */
+public class LocalMavenResolver implements MavenResolver {
+
+ private final Path systemRepository;
+
+ public LocalMavenResolver(Path systemRepository) {
+ this.systemRepository = systemRepository.toAbsolutePath().normalize();
+ }
+
+ /**
+ * Create a resolver for the repository configured by the running Karaf distribution.
+ *
+ * @return a resolver rooted at {@code karaf.home/karaf.default.repository}.
+ */
+ public static LocalMavenResolver forKarafSystem() {
+ Path home = Paths.get(System.getProperty("karaf.home", "karaf"));
+ Path repository = Paths.get(System.getProperty("karaf.default.repository", "system"));
+ if (!repository.isAbsolute()) {
+ repository = home.resolve(repository);
+ }
+ return new LocalMavenResolver(repository);
+ }
Review Comment:
```suggestion
public static LocalMavenResolver forKarafSystem() {
Path repository = Paths.get(System.getProperty("karaf.default.repository", "system"));
if (!repository.isAbsolute()) {
Path home = Paths.get(System.getProperty("karaf.home", "karaf"));
repository = home.resolve(repository);
}
return new LocalMavenResolver(repository);
}
```
This way, we only fetch the home path if it is actually needed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@karaf.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(features): decouple features service from Pax URL [karaf]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #2928:
URL: https://github.com/apache/karaf/pull/2928#issuecomment-5752043833
## Test Results
522 files - 204 522 suites - 204 10m 1s ⏱️ - 1h 5m 19s
777 tests - 208 741 ✅ - 196 34 💤 - 14 0 ❌ ±0 2 🔥 +2
2 331 runs - 624 2 223 ✅ - 588 102 💤 - 42 0 ❌ ±0 6 🔥 +6
For more details on these errors, see [this check](https://github.com/apache/karaf/runs/106133905697).
Results for commit 86564e0d. ± Comparison against base commit a110f751.
<details>
<summary>This pull request <b>removes</b> 210 and <b>adds</b> 2 tests. <i>Note that renamed tests count towards both.</i></summary>
```
org.apache.karaf.examples.itests.ExampleITest ‑ listBundleCommand
org.apache.karaf.examples.itests.ExampleWithConfigITest ‑ simpleTest
org.apache.karaf.itests.BundleTest ‑ capabilitiesCommand
org.apache.karaf.itests.BundleTest ‑ classesCommand
org.apache.karaf.itests.BundleTest ‑ diagCommand
org.apache.karaf.itests.BundleTest ‑ findClassCommand
org.apache.karaf.itests.BundleTest ‑ headersCommand
org.apache.karaf.itests.BundleTest ‑ infoCommand
org.apache.karaf.itests.BundleTest ‑ installNonOsgiBundle
org.apache.karaf.itests.BundleTest ‑ installUninstallCommand
…
```
```
org.apache.karaf.examples.itests.ExampleITest ‑ Unknown test
org.apache.karaf.examples.itests.ExampleWithConfigITest ‑ Unknown test
```
</details>
[test-results]:data:application/gzip;base64,H4sIALYxsGoC/03NSQ4CIRCF4at0WLuAYmwvYwhDQuzB0LAy3t1CBXv5fxUeTxLTEg5ynSTAZSJHTeWUvmZb0r4hKMoQ8FjaWWvd63ZU5xoJ9qd7eiBxMSTatKDQASHnPaO0b3Ld2ihwzn7VRwGAD/qOMtqfnEc/3TcVgtvXNRUMYpRUIlDPddQAwTMpjOPGaulmG4M33vLoZ0Zeb2DGKOgOAQAA
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@karaf.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(features): decouple features service from Pax URL [karaf]
Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on code in PR #2928:
URL: https://github.com/apache/karaf/pull/2928#discussion_r4191932675
##########
features/core/src/main/java/org/apache/karaf/features/internal/download/impl/LocalMavenResolver.java:
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.features.internal.download.impl;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import org.apache.karaf.features.spi.MavenResolver;
+import org.apache.karaf.util.maven.Parser;
+
+/**
+ * Resolves Maven coordinates from the Karaf distribution's local system repository only.
+ */
+public class LocalMavenResolver implements MavenResolver {
+
+ private final Path systemRepository;
+
+ public LocalMavenResolver(Path systemRepository) {
+ this.systemRepository = systemRepository.toAbsolutePath().normalize();
+ }
+
+ /**
+ * Create a resolver for the repository configured by the running Karaf distribution.
+ *
+ * @return a resolver rooted at {@code karaf.home/karaf.default.repository}.
+ */
+ public static LocalMavenResolver forKarafSystem() {
+ Path home = Paths.get(System.getProperty("karaf.home", "karaf"));
+ Path repository = Paths.get(System.getProperty("karaf.default.repository", "system"));
+ if (!repository.isAbsolute()) {
+ repository = home.resolve(repository);
+ }
+ return new LocalMavenResolver(repository);
+ }
+
+ @Override
+ public File resolve(String url) throws IOException {
+ if (url == null || !url.startsWith("mvn:")) {
+ throw new MalformedURLException("Expected a mvn: URI: " + url);
+ }
+ String artifactPath = Parser.pathFromMaven(url);
+ Path artifact = systemRepository.resolve(artifactPath).normalize();
+ if (!artifact.startsWith(systemRepository)) {
+ throw new IOException("Maven artifact path is outside the Karaf system repository: " + url);
+ }
+ if (!artifact.toFile().isFile()) {
+ throw new FileNotFoundException("Maven artifact " + url + " was not found in the Karaf system repository "
+ + systemRepository);
+ }
+ return artifact.toFile();
+ }
+
+ @Override
+ public File resolve(String url, Exception previousException) throws IOException {
+ return resolve(url);
Review Comment:
I updated the SPI to clarify.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@karaf.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(features): decouple features service from Pax URL [karaf]
Posted by "CptBartender (via GitHub)" <gi...@apache.org>.
CptBartender commented on code in PR #2928:
URL: https://github.com/apache/karaf/pull/2928#discussion_r4187870438
##########
features/core/src/main/java/org/apache/karaf/features/internal/download/impl/LocalMavenResolver.java:
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.features.internal.download.impl;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import org.apache.karaf.features.spi.MavenResolver;
+import org.apache.karaf.util.maven.Parser;
+
+/**
+ * Resolves Maven coordinates from the Karaf distribution's local system repository only.
+ */
+public class LocalMavenResolver implements MavenResolver {
+
+ private final Path systemRepository;
+
+ public LocalMavenResolver(Path systemRepository) {
+ this.systemRepository = systemRepository.toAbsolutePath().normalize();
+ }
+
+ /**
+ * Create a resolver for the repository configured by the running Karaf distribution.
+ *
+ * @return a resolver rooted at {@code karaf.home/karaf.default.repository}.
+ */
+ public static LocalMavenResolver forKarafSystem() {
+ Path home = Paths.get(System.getProperty("karaf.home", "karaf"));
+ Path repository = Paths.get(System.getProperty("karaf.default.repository", "system"));
+ if (!repository.isAbsolute()) {
+ repository = home.resolve(repository);
+ }
+ return new LocalMavenResolver(repository);
+ }
+
+ @Override
+ public File resolve(String url) throws IOException {
+ if (url == null || !url.startsWith("mvn:")) {
+ throw new MalformedURLException("Expected a mvn: URI: " + url);
+ }
+ String artifactPath = Parser.pathFromMaven(url);
+ Path artifact = systemRepository.resolve(artifactPath).normalize();
+ if (!artifact.startsWith(systemRepository)) {
+ throw new IOException("Maven artifact path is outside the Karaf system repository: " + url);
+ }
+ if (!artifact.toFile().isFile()) {
+ throw new FileNotFoundException("Maven artifact " + url + " was not found in the Karaf system repository "
+ + systemRepository);
+ }
+ return artifact.toFile();
+ }
+
+ @Override
+ public File resolve(String url, Exception previousException) throws IOException {
+ return resolve(url);
Review Comment:
This implementation considers every exception to be non-retryable - why do we allow retrials here? Wouldn't an exception be more suitable?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@karaf.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(features): decouple features service from Pax URL [karaf]
Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on code in PR #2928:
URL: https://github.com/apache/karaf/pull/2928#discussion_r4191869325
##########
features/core/src/main/java/org/apache/karaf/features/internal/download/impl/LocalMavenResolver.java:
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.features.internal.download.impl;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import org.apache.karaf.features.spi.MavenResolver;
+import org.apache.karaf.util.maven.Parser;
+
+/**
+ * Resolves Maven coordinates from the Karaf distribution's local system repository only.
+ */
+public class LocalMavenResolver implements MavenResolver {
+
+ private final Path systemRepository;
+
+ public LocalMavenResolver(Path systemRepository) {
+ this.systemRepository = systemRepository.toAbsolutePath().normalize();
+ }
+
+ /**
+ * Create a resolver for the repository configured by the running Karaf distribution.
+ *
+ * @return a resolver rooted at {@code karaf.home/karaf.default.repository}.
+ */
+ public static LocalMavenResolver forKarafSystem() {
+ Path home = Paths.get(System.getProperty("karaf.home", "karaf"));
+ Path repository = Paths.get(System.getProperty("karaf.default.repository", "system"));
+ if (!repository.isAbsolute()) {
+ repository = home.resolve(repository);
+ }
+ return new LocalMavenResolver(repository);
+ }
Review Comment:
That makes sense. Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@karaf.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org