Karaf assembly

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Karaf assembly

Matthias
This post was updated on .
Hi all,

i want to create an assembly for a own karaf-instance with brand, resource, features and bundles. I looked at

https://github.com/apache/karaf/blob/master/examples/karaf-maven-example/karaf-maven-example-assembly/pom.xml
http://svn.apache.org/repos/asf/karaf/site/production/manual/latest/custom-distribution.html

and have a working solution which has ressources and brand. Also i  get a copy of relevant features in target/features-repo.

But what i don't get is the installation of my own features and own bundles. I am not finding examples for that. How can i install custom features? Is it possible to have them installed in the packaged distribution? I have not for every custom bundle a own feature. So is it possible to install and start the bundles?

The pom for the distribution (so far) is:


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">

        <modelVersion>4.0.0</modelVersion>

        <parent>
                <groupId>org.rogatio.circlead.sunray</groupId>
                <artifactId>circlead-core</artifactId>
                <version>0.7.16-SNAPSHOT</version>
                <relativePath>../pom.xml</relativePath>
        </parent>

        <artifactId>circlead-install</artifactId>
        <name>Circlead :: Distribution</name>
        <packaging>karaf-assembly</packaging>

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

        <build>
               
                <resources>
                        <resource>
                                <directory>src/main/resources</directory>
                                <filtering>false</filtering>
                                <includes>
                                        <include>**/*</include>
                                </includes>
                        </resource>
                        <resource>
                                <directory>src/main/filtered-resources</directory>
                                <filtering>true</filtering>
                                <includes>
                                        <include>**/*</include>
                                </includes>
                        </resource>
                </resources>

                <plugins>
                       
                        <plugin>
                                <groupId>org.apache.karaf.tooling</groupId>
                                <artifactId>karaf-maven-plugin</artifactId>
                                <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>
                                                       
<descriptor>mvn:org.apache.karaf.features/standard/${karaf.version}/xml/features</descriptor>
                                                       
<descriptor>mvn:org.rogatio.circlead.sunray/circlead-core-features/0.7.16-SNAPSHOT/xml</descriptor>
                                                        </descriptors>
                                                        <features>
                                                                <feature>circlead-core</feature>
                                                        </features>
                                                        <repository>target/features-repo</repository>
                                                </configuration>
                                        </execution>
                                </executions>
                                <configuration>
                                        <bootFeatures>
                                                <feature>standard</feature>
                                        </bootFeatures>
                                        <archiveZip>true</archiveZip>
                                </configuration>
                        </plugin>
                </plugins>
        </build>

</project>

Regards,
Matthias




--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: Karaf assembly

jbonofre
Hi,

You can take a look on the docker example, it contains a app included in a custom bistro:


Basically, you just have to create a features XML and include in dependency of your assembly.
Then, you can add your applications:
- as installed feature (meaning that it will be included in the system folder of your custom distribution for offline use but not start by default)
- as boot feature (added in etc/org.apache.karaf.features.cfg)
- as startup feature (very early stage of the startup even before the features service, added in etc/startup.properties)

Regards
JB

Le 6 févr. 2020 à 22:17, Matthias <[hidden email]> a écrit :

Hi all,

i want to create an assembly for a own karaf-instance with brand, resource,
features and bundles. I looked at

https://github.com/apache/karaf/blob/master/examples/karaf-maven-example/karaf-maven-example-assembly/pom.xml
http://svn.apache.org/repos/asf/karaf/site/production/manual/latest/custom-distribution.html

and have a working solution which has ressources and brand. Also i  get a
copy of relevant features in target/features-repo.

But what i don't get is the installation ob my own features and own bundles.
I am not finding examples for that. How can i install custom features? Is it
possible to have them installed in the packaged distribution? I have not for
every custom bundle a own feature. So is it possible to install and start
the bundles?

The pom for the distribution (so far) is:


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.rogatio.circlead.sunray</groupId>
<artifactId>circlead-core</artifactId>
<version>0.7.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>circlead-install</artifactId>
<name>Circlead :: Distribution</name>
<packaging>karaf-assembly</packaging>

<dependencies>
<dependency>

<groupId>org.apache.karaf.features</groupId>
<artifactId>framework</artifactId>
<version>${karaf.version}</version>
<type>kar</type>
</dependency>
<dependency>

<groupId>org.apache.karaf.features</groupId>
<artifactId>standard</artifactId>
<version>${karaf.version}</version>
<classifier>features</classifier>
<type>xml</type>
<scope>runtime</scope>
</dependency>
</dependencies>

<build>

<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>**/*</include>
</includes>
</resource>
<resource>
<directory>src/main/filtered-resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>

<plugins>

<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<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>

<descriptor>mvn:org.apache.karaf.features/standard/${karaf.version}/xml/features</descriptor>

<descriptor>mvn:org.rogatio.circlead.sunray/circlead-core-features/0.7.16-SNAPSHOT/xml</descriptor>
</descriptors>
<features>
<feature>circlead-core</feature>
</features>
<repository>target/features-repo</repository>
</configuration>
</execution>
</executions>
<configuration>
<bootFeatures>
<feature>standard</feature>
</bootFeatures>
<archiveZip>true</archiveZip>
</configuration>
</plugin>
</plugins>
</build>

</project>

Regards,
Matthias




--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Reply | Threaded
Open this post in threaded view
|

Re: Karaf assembly

Matthias
Hi,

the hint with the

 

to "featurize" any bundle works like charm. But how can i install my own
features? For example i have a feature which i install "normally" with

feature:repo-add
mvn:org.rogatio.circlead.sunray/circlead-core-features/LATEST/xml;
feature:install circlead-core

The feature.xml is



The pom of the features is



Somehow it seems that when i use the karaf-maven-plugin to install all
bundles "manually in the assembly" some functions are not correctly working,
including the default karaf logger. Also it seems that all exported libs in
the bundle are separately wrapped.

I tried some approaches for my own features, but without success. Is it
possible to assemble a custom feature with karaf-maven-plugin? How?

Regards,
Matthias







--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: Karaf assembly

jbonofre
Hi

Just add your features xml as dependency and your feature as boot feature.

You can mimic the docker example (dynamic distribution).

If you need ping me directly I will help you. 

By the way, we are improving the tools right now. 

Regards
JB

Le ven. 7 f?vr. 2020 ? 17:32, Matthias <[hidden email]> a ?crit :
Hi,

the hint with the



to "featurize" any bundle works like charm. But how can i install my own
features? For example i have a feature which i install "normally" with

feature:repo-add
mvn:org.rogatio.circlead.sunray/circlead-core-features/LATEST/xml;
feature:install circlead-core

The feature.xml is



The pom of the features is



Somehow it seems that when i use the karaf-maven-plugin to install all
bundles "manually in the assembly" some functions are not correctly working,
including the default karaf logger. Also it seems that all exported libs in
the bundle are separately wrapped.

I tried some approaches for my own features, but without success. Is it
possible to assemble a custom feature with karaf-maven-plugin? How?

Regards,
Matthias







--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html