[ https://issues.apache.org/jira/browse/KARAF-3347?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Grzegorz Grzybek resolved KARAF-3347. ------------------------------------- Resolution: Fixed > '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 > Assignee: Grzegorz Grzybek > Fix For: 4.2.0, 4.1.2 > > > I slightly modified Karaf's standard feature to give you an idea about the > configuration leading to faults (see inline comments). > {code:xml} > <build> > <plugins> > <plugin> > <groupId>org.apache.karaf.tooling</groupId> > <artifactId>karaf-maven-plugin</artifactId> > <version>3.0.2</version> > <extensions>true</extensions> > <executions> > <execution> > <id>features-add-to-repo</id> > <phase>generate-resources</phase> > <goals> > <goal>features-add-to-repository</goal> > </goals> > <configuration> > <descriptors> > <-- LATEST won't work for descriptors.--> > > <descriptor>mvn:org.apache.karaf.features/standard-mod/LATEST/xml/features</descriptor> > </descriptors> > <features> > <feature>http</feature> > </features> > </configuration> > </execution> > </executions> > </plugin> > </plugins> > </build> > {code} > {code:xml} > <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). --> > > <repository>mvn:org.ops4j.pax.web/pax-web-features/LATEST/xml/features</repository> > <feature name="http" version="3.0.2" description="Implementation of the > OSGI HTTP Service" resolver="(obr)"> > <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> > </feature> > </features> > {code} > 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. > {code:title=AbstractFeatureMojo.java|borderStyle=solid} > 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); > descriptorArtifacts.add(descriptor); > // 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) { > bundles.add(uri); > } > // 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); > } > } > } > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)