Cλstor Cλstor - 1 month ago 18
Java Question

StartupFeatures with karaf-maven-plugin

I'm trying to create my own karaf distribution, right now i'm able to assembly my features without any problem, but i'm not being able to register them to the startup.properties using the recommended tag.

<startupFeature>foo</startupFeature> This will result in the feature bundles
being listed in startup.properties at the appropriate start level and the bundles
being copied into the "system" internal repository. You can use feature_name
or feature_name/feature_version formats.


When i use the tag i get the following error:

[ERROR] Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.0.5:assembly (default-cli) on project winthor-karaf: Unable to build assembly: Unable to resolve root: missing requirement [root] osgi.identity; osgi.ide
ntity=winthor-core-servico; type=karaf.feature; filter:="(&(osgi.identity=winthor-core-servico)(type=karaf.feature))" -> [Help 1]


And if i use the installedFeatures tag before the startUpFeatures tag, the error goes away, but the features bundles are not registered at the startup.properties file, so they won't start-up.

What i'm doing wrong?




Here is the relevant part of my pom:

<dependencies>
<dependency>
<groupId>org.apache.karaf.features</groupId>
<artifactId>framework</artifactId>
<version>4.0.5</version>
<type>kar</type>
</dependency>
<dependency>
<groupId>org.apache.karaf.features</groupId>
<artifactId>standard</artifactId>
<classifier>features</classifier>
<version>4.0.5</version>
<scope>runtime</scope>
<type>xml</type>
</dependency>
<dependency>
<groupId>org.apache.karaf.features</groupId>
<artifactId>spring</artifactId>
<classifier>features</classifier>
<type>xml</type>
<version>4.0.5</version>
<scope>runtime</scope>
</dependency>


<dependency>
<groupId>br.com.pcsist.winthor.core</groupId>
<artifactId>winthor-core-features</artifactId>
<version>1.0.0</version>
<scope>runtime</scope>
<classifier>features</classifier>
<type>xml</type>
</dependency>
<dependency>
<groupId>br.com.pcsist.winthor.core</groupId>
<artifactId>winthor-autenticacao-features</artifactId>
<version>1.0.0</version>
<scope>runtime</scope>
<classifier>features</classifier>
<type>xml</type>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>4.0.5</version>
<extensions>true</extensions>
<configuration>
<bootFeatures>
<bootFeature>instance</bootFeature>
<bootFeature>package</bootFeature>
<bootFeature>log</bootFeature>
<bootFeature>ssh</bootFeature>
<bootFeature>aries-blueprint</bootFeature>
<bootFeature>framework</bootFeature>
<bootFeature>system</bootFeature>
<bootFeature>feature</bootFeature>
<bootFeature>shell</bootFeature>
<bootFeature>management</bootFeature>
<bootFeature>service</bootFeature>
<bootFeature>jaas</bootFeature>
<bootFeature>shell-compat</bootFeature>
<bootFeature>deployer</bootFeature>
<bootFeature>diagnostic</bootFeature>
<bootFeature>wrap</bootFeature>
<bootFeature>bundle</bootFeature>
<bootFeature>config</bootFeature>
<bootFeature>kar</bootFeature>
</bootFeatures>
<startupFeatures>
<startupFeature>winthor-core-data</startupFeatur>
<startupFeature>winthor-core-servico</startupFeature>
<feature>winthor-autenticacao</feature>
</startupFeatures>
</configuration>
</plugin>
</plugins>
</build>

Answer

We solved our problem using a different approach, we found out that the startup.properties bundles run before the bootFeatures, that wasn't clear in the documentation, so we created a simple kar with our core features and referenced it as a compile scope to the custom karaf distribution.

The remaining features were registered as runtime-scoped Boot Features and it worked like a charm.

And about the karaf-maven-plugin, it seems that the startupfeatures functionality is broken.