mavenapache-karafkaraf-maven-plugin

Can karaf-maven-plugin use dependencies from the reactor?


We are using karaf-maven-plugin to validate features.xml in a project with multiple modules. A typical feature definition looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<features name"commons-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
    <feature name="commons" version="${project.version}">
        <feature prerequisite="true">wrap</feature>
        <bundle>mvn:org.example/commons/${project.version}</bundle>
    </feature>
</features>

The problem is that the check happens with the bundle in the local repository, not the bundle being built. In hindsight, there was no way to use the new bundle, because we followed this example and we attached the karaf:verify goal to the process-resources lifecycle phase.

Attaching the karaf:verify goal to the install lifecycle phase works, but is there a way to make karaf-maven-plugin look up mvn: references in the reactor so it can run with mvn verify instead of mvn install?

Limiting it to the local repository would also be useful, because it can download dependencies from remote repositories (ignoring the --offline Maven option) and "work" right until the version changes.


Solution

  • It is not possible with Karaf 4.0 or 4.1, but this has been fixed for Karaf 4.2, see this JIRA issue and the corresponding commit.