karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Achim Finke (JIRA)" <j...@apache.org>
Subject [jira] [Created] (KARAF-3347) 'LATEST' placeholder is not resolved correctly for descriptors and repositories
Date Tue, 04 Nov 2014 12:42:34 GMT
Achim Finke created KARAF-3347:

             Summary: 'LATEST' placeholder is not resolved correctly for descriptors and repositories
                 Key: KARAF-3347
                 URL: https://issues.apache.org/jira/browse/KARAF-3347
             Project: Karaf
          Issue Type: Bug
          Components: karaf-tooling
    Affects Versions: 3.0.2
            Reporter: Achim Finke

I slightly modified Karaf's standard feature to give you an idea about the configuration leading
to faults (see inline comments).

                            <-- LATEST won't work for descriptors.-->

<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.1" name="standard-3.0.2">
    <!-- LATEST won't work for repositories as artifacts are resolved by Maven but not
copied into Target folder (searching for LATEST placeholder instead of the version). -->
    <feature name="http" version="3.0.2" description="Implementation of the OSGI HTTP Service"
        <feature version="[3.1.2,5)">pax-http</feature>
        <!-- LATEST will work for bundles (guess this is the same than defining no version)
        <bundle start-level="30">mvn:org.apache.karaf.http/org.apache.karaf.http.core/LATEST</bundle>

        <bundle start-level="30">mvn:org.apache.karaf.http/org.apache.karaf.http.command/LATEST</bundle>

I debugged into the Plugin and saw that the version information are already available via
the previously resolved descriptor but not taken when building the repoURI. 

In a first attempt i adjusted the uri using the descriptor which made 'LATEST' work.

protected void retrieveDescriptorsRecursively(String uri, Set<String> bundles, Map<String,
Feature> featuresMap) {
    Artifact descriptor;
    try {
        descriptor = resourceToArtifact(uri, true);
    } catch (MojoExecutionException e) {
        throw new RuntimeException(e.getMessage(), e);
    if (descriptor != null) {
        // descriptor is resolved via Maven resolver ('latest'-Placeholder is replaced)
        resolveArtifact(descriptor, remoteRepos);
        // adjust uri with version information from descriptor as URI is not resolved in the
process (see subsequent comment)
        uri = uri.toLowerCase();
        uri = uri.replace("/latest/", "/" + descriptor.getBaseVersion() + "/");
    if (includeMvnBasedDescriptors) {
    // translateFromMaven-Method just parses URI into the right format, it does not any resolving
('latest'-Placeholder won't be replaced)
    URI repoURI = URI.create(translateFromMaven(uri.replaceAll(" ", "%20")));
    Repository repo = new Repository(repoURI, defaultStartLevel);
    for (Feature f : repo.getFeatures()) {
        featuresMap.put(f.getName() + "/" + f.getVersion(), f);
    if (resolveDefinedRepositoriesRecursively) {
        for (String r : repo.getDefinedRepositories()) {
            retrieveDescriptorsRecursively(r, bundles, featuresMap);

This message was sent by Atlassian JIRA

View raw message