You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Marcus Bond <ma...@devasoftware.co.uk> on 2014/10/06 19:54:38 UTC

Custom distribution with features

Hi,

I am trying to figure out how to set up the pom for a karaf-assembly in
order to produce a custom distribution.

I know the names of the features I want installed and started, such as
jetty, jms, cxf, camel etc. however I would like to know how I can
determine the dependencies that are required in the pom in order that the
custom distro will have all required dependencies in the "system" folder.
The environment it will run in has no access to any repositories so will
need to have a complete system folder generated at build time.

How do we determine the maven dependency that a given feature requires?

Regards,
Marcus.

Re: Custom distribution with features

Posted by Marcus Bond <ma...@devasoftware.co.uk>.
So I'm using the karaf-maven-plugin and version 3.0.1 of Karaf. I think I
understand how the plugin works but the issue is knowing the dependencies.

In the documentation for a custom distribution (
http://karaf.apache.org/manual/latest/developers-guide/custom-distribution.html)
it shows a pom file with the following contained:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>3.0.1</version>
<extensions>true</extensions>
<configuration>
<!-- no startupFeatures -->
<bootFeatures>
<feature>standard</feature>
<feature>management</feature>
</bootFeatures>
<!-- no installedFeatures -->
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

Now in addition to this there are some
dependencies, org.apache.karaf.features/framework
and org.apache.karaf.features/standard. What I am confused about is how
someone can determine that it is these two dependencies that provide the
"standard" and "management" features that are specified as bootFeatures.

I require other features, jetty, jms, camel, blueprint, activemq etc., I
know the name of the features I want so can add those to the bootFeatures /
installedFeatures / startupFeatures however I do not know the names of the
dependency artifacts that provide these features so that my custom
distribution has everything it needs when it is built with the relevant
artifacts pre-installed in the system directory.

Marcus.



On Mon, Oct 6, 2014 at 8:10 PM, Matthieu Vincent <mv...@gmail.com>
wrote:

> On features-maven-plugin you can set which features you'll need and the
> plugin will build the repository according to features definitions : easy :)
> Le 6 oct. 2014 21:07, "Marcus Bond" <ma...@devasoftware.co.uk> a écrit :
>
> Thanks, however it's not so much how I do it as the docs are ok and the
>> Pom I have works but without providing all dependencies I will need. I need
>> to know how I find out the names of the dependency artefacts that define
>> the features I would like to include. E.g if I want a camel feature how
>> do I determine which artifact provides that feature?
>> M
>>
>> On Monday, October 6, 2014, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
>>
>>> Hi Marcus,
>>>
>>> you can take a look on the Karaf distribution itself (we eat our own dog
>>> food ;)).
>>>
>>> The assembly archetype also provides a skeleton to create your distro.
>>>
>>> The documentation also provides good start point:
>>>
>>> http://karaf.apache.org/manual/latest/developers-
>>> guide/custom-distribution.html
>>>
>>> Regards
>>> JB
>>>
>>> On 10/06/2014 07:54 PM, Marcus Bond wrote:
>>>
>>>> Hi,
>>>>
>>>> I am trying to figure out how to set up the pom for a karaf-assembly in
>>>> order to produce a custom distribution.
>>>>
>>>> I know the names of the features I want installed and started, such as
>>>> jetty, jms, cxf, camel etc. however I would like to know how I can
>>>> determine the dependencies that are required in the pom in order that
>>>> the custom distro will have all required dependencies in the "system"
>>>> folder. The environment it will run in has no access to any repositories
>>>> so will need to have a complete system folder generated at build time.
>>>>
>>>> How do we determine the maven dependency that a given feature requires?
>>>>
>>>> Regards,
>>>> Marcus.
>>>>
>>>
>>> --
>>> Jean-Baptiste Onofré
>>> jbonofre@apache.org
>>> http://blog.nanthrax.net
>>> Talend - http://www.talend.com
>>>
>>

Re: Custom distribution with features

Posted by Matthieu Vincent <mv...@gmail.com>.
On features-maven-plugin you can set which features you'll need and the
plugin will build the repository according to features definitions : easy :)
Le 6 oct. 2014 21:07, "Marcus Bond" <ma...@devasoftware.co.uk> a écrit :

> Thanks, however it's not so much how I do it as the docs are ok and the
> Pom I have works but without providing all dependencies I will need. I need
> to know how I find out the names of the dependency artefacts that define
> the features I would like to include. E.g if I want a camel feature how
> do I determine which artifact provides that feature?
> M
>
> On Monday, October 6, 2014, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
>
>> Hi Marcus,
>>
>> you can take a look on the Karaf distribution itself (we eat our own dog
>> food ;)).
>>
>> The assembly archetype also provides a skeleton to create your distro.
>>
>> The documentation also provides good start point:
>>
>> http://karaf.apache.org/manual/latest/developers-
>> guide/custom-distribution.html
>>
>> Regards
>> JB
>>
>> On 10/06/2014 07:54 PM, Marcus Bond wrote:
>>
>>> Hi,
>>>
>>> I am trying to figure out how to set up the pom for a karaf-assembly in
>>> order to produce a custom distribution.
>>>
>>> I know the names of the features I want installed and started, such as
>>> jetty, jms, cxf, camel etc. however I would like to know how I can
>>> determine the dependencies that are required in the pom in order that
>>> the custom distro will have all required dependencies in the "system"
>>> folder. The environment it will run in has no access to any repositories
>>> so will need to have a complete system folder generated at build time.
>>>
>>> How do we determine the maven dependency that a given feature requires?
>>>
>>> Regards,
>>> Marcus.
>>>
>>
>> --
>> Jean-Baptiste Onofré
>> jbonofre@apache.org
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>>
>

Re: Custom distribution with features

Posted by Marcus Bond <ma...@devasoftware.co.uk>.
Thanks, however it's not so much how I do it as the docs are ok and the Pom
I have works but without providing all dependencies I will need. I need to
know how I find out the names of the dependency artefacts that define the
features I would like to include. E.g if I want a camel feature how do I
determine which artifact provides that feature?
M

On Monday, October 6, 2014, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:

> Hi Marcus,
>
> you can take a look on the Karaf distribution itself (we eat our own dog
> food ;)).
>
> The assembly archetype also provides a skeleton to create your distro.
>
> The documentation also provides good start point:
>
> http://karaf.apache.org/manual/latest/developers-
> guide/custom-distribution.html
>
> Regards
> JB
>
> On 10/06/2014 07:54 PM, Marcus Bond wrote:
>
>> Hi,
>>
>> I am trying to figure out how to set up the pom for a karaf-assembly in
>> order to produce a custom distribution.
>>
>> I know the names of the features I want installed and started, such as
>> jetty, jms, cxf, camel etc. however I would like to know how I can
>> determine the dependencies that are required in the pom in order that
>> the custom distro will have all required dependencies in the "system"
>> folder. The environment it will run in has no access to any repositories
>> so will need to have a complete system folder generated at build time.
>>
>> How do we determine the maven dependency that a given feature requires?
>>
>> Regards,
>> Marcus.
>>
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>

Re: Custom distribution with features

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Marcus,

you can take a look on the Karaf distribution itself (we eat our own dog 
food ;)).

The assembly archetype also provides a skeleton to create your distro.

The documentation also provides good start point:

http://karaf.apache.org/manual/latest/developers-guide/custom-distribution.html

Regards
JB

On 10/06/2014 07:54 PM, Marcus Bond wrote:
> Hi,
>
> I am trying to figure out how to set up the pom for a karaf-assembly in
> order to produce a custom distribution.
>
> I know the names of the features I want installed and started, such as
> jetty, jms, cxf, camel etc. however I would like to know how I can
> determine the dependencies that are required in the pom in order that
> the custom distro will have all required dependencies in the "system"
> folder. The environment it will run in has no access to any repositories
> so will need to have a complete system folder generated at build time.
>
> How do we determine the maven dependency that a given feature requires?
>
> Regards,
> Marcus.

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Custom distribution with features

Posted by Srikanth Hugar <sr...@gmail.com>.
Below example may help. feature file basically contains the maven
dependency and during build time, plugin verifies whether all dependencies
satisfied to make the build successful.

If build successful, below pom creates a distr , you can extract and use
directly by starting the karaf. replace the variables and provide parent,
group id and artifact id information in pom.

I am not sure whether this answer helps you, let me know if you need more
details.

<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
...............................

<dependencies>
<dependency>
<groupId>org.apache.karaf</groupId>
<artifactId>apache-karaf</artifactId>
<version>${karaf.version}</version>
<type>tar.gz</type>
<exclusions>
<exclusion>
<groupId>org.eclipse</groupId>
<artifactId>osgi</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse</groupId>
<artifactId>org.eclipse.osgi</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.cxf.karaf</groupId>
<artifactId>apache-cxf</artifactId>
<version>${cxf.version}</version>
<type>xml</type>
<classifier>features</classifier>
</dependency>
</dependencies>

<build>
<plugins>
<!-- Uncompress the standard Karaf distribution -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.apache.karaf</groupId>
<artifactId>apache-karaf</artifactId>
<type>tar.gz</type>
<outputDirectory>${project.build.directory}/dependencies</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
 <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<outputDirectory>${custom-karaf.dir}</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
<executions>
<execution>
<id>copy-resources</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Download features. -->
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>features-maven-plugin</artifactId>
<version>2.3.4</version>
<executions>
<execution>
<id>add-features-to-repo</id>
<phase>prepare-package</phase>
<goals>
<goal>add-features-to-repo</goal>
</goals>
<configuration>
<descriptors>

 <descriptor>mvn:org.apache.karaf.features/standard/${karaf.version}/xml/features</descriptor>
<descriptor>mvn:org.apache.karaf.features/enterprise/${karaf.version}/xml/features</descriptor>
<descriptor>file:${custom-karaf.system.dir}/spring-3.0.0-features.xml</descriptor>
<descriptor>file:${custom-karaf.system.dir}/apache-cxf-2.7.7-features.xml</descriptor>
............................................................................
</descriptors>
<features>
<feature>standard</feature>
<feature>config</feature>
<feature>ssh</feature>
<feature>kar</feature>
<feature>management</feature>
<feature>webconsole</feature>
<feature>http</feature>
<feature>jpa</feature>
<feature>transaction</feature>
<feature>spring</feature>
<feature>spring-dm-web</feature>
<feature>spring-orm</feature>
<feature>package</feature>
<feature>cxf</feature>
............................................
</features>
<repository>${custom-karaf.system.dir}</repository>
</configuration>
</execution>
</executions>
</plugin>
<!-- Build tar.gz artifact. -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>${basedir}/src/main/assemble/karaf-assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>karaf-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>


Srikanth Hugar
www.gharki.com



On Mon, Oct 6, 2014 at 11:24 PM, Marcus Bond <ma...@devasoftware.co.uk>
wrote:

> Hi,
>
> I am trying to figure out how to set up the pom for a karaf-assembly in
> order to produce a custom distribution.
>
> I know the names of the features I want installed and started, such as
> jetty, jms, cxf, camel etc. however I would like to know how I can
> determine the dependencies that are required in the pom in order that the
> custom distro will have all required dependencies in the "system" folder.
> The environment it will run in has no access to any repositories so will
> need to have a complete system folder generated at build time.
>
> How do we determine the maven dependency that a given feature requires?
>
> Regards,
> Marcus.
>