Hi Davi,
Yes, you have to reference your features.xml in the pom.xml.
By default, kar goal is looking for
${project.build.directory}/feature/feature.xml.
If your feature.xml is on another place, you can specify it with
featuresFile configuration:
<configuration>
<featuresFile>path/to/feature.xml</featuresFile>
</configuration>
Regards
JB
On 11/01/2020 02:45, Davi Baldin Tavares wrote:
> JB, Thanks.
>
> I’m not getting the big picture here even reading Karaf maven plugin docs...
>
> Steps I did:
>
> 1. Git clone karaf
> 2. Goto to karat-maven-example-kar
> 3. Edited features-repo.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
> <features name="examples"
> xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
> <feature name="kar-example" version="1.0-SNAPSHOT">
> <bundle>mvn:org.mongodb/mongo-java-driver/3.11.0</bundle>
> <bundle>mvn:com.google.code.gson/gson/2.8.5</bundle>
> <bundle>mvn:commons-io/commons-io/2.6</bundle>
> <bundle>mvn:org.apache.commons/commons-lang3/3.9</bundle>
> <bundle>mvn:org.apache.commons/commons-text/1.8</bundle>
> <feature>jetty</feature>
> <feature>war</feature>
> <feature>webconsole</feature>
> <feature>pax-jdbc-oracle</feature>
> </feature>
> </features>
>
> 4. Executed mvn clean compile karaf:kar
>
> 5. The compiled kar file did not contain any reference to the
> features-repo.xml file I’ve edited. Should I edit pom.xml to reference it?
>
> My goal is being able to drop a file (kar here?) into deploy with all my
> app’s dependencies...
>
> Cheers,
>
> Davi
>
>
>> On 10 Jan 2020, at 02:06, Jean-Baptiste Onofré <[email protected]> wrote:
>>
>> Hi,
>>
>> just reference this feature in your feature.
>>
>> Basically, you create the features repo XML like this:
>>
>> <features ...>
>>
>> <feature name="my" version="xx">
>> <feature>jetty</feature>
>> <feature>war</feature>
>> <feature>webconsole</feature>
>> <feature>pax-jdbc-oracle</feature>
>> <bundle>...</bundle>
>> <feature>
>>
>> </features>
>>
>> you provide this features XML to the maven plugin to create the kar
>> similar to the example here:
>>
>> https://github.com/apache/karaf/tree/master/examples/karaf-maven-example/karaf-maven-example-kar
>>
>> The kar installation will install the my feature including the
>> transitive features.
>>
>> Another approach instead of a kar is to create a custom distribution.
>>
>> Regards
>> JB
>>
>> On 10/01/2020 04:02, Davi Baldin Tavares wrote:
>>> Hi,
>>>
>>> I would like to create a KAR file using karaf-maven-plugin
>>>
>>> Dependencies are being inserted correctly as maven bundles, however, how
>>> to include other features like that?
>>>
>>> feature:install jetty
>>> feature:install war
>>> feature:install webconsole
>>> feature:install pax-jdbc-oracle
>>>
>>> Basically, I would like to drop a .kar file in the deploy directory that
>>> does all the feature:install and bundle:install behind that is required
>>> for my application…
>>>
>>> Regards,
>>>
>>> Davi
>>>
>>>
>>>
>>>
>>> pom.xml file
>>>
>>>
>>>
>>>
>>> <projectxmlns=/"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>
>>> <groupId>io.infolayer.siteview</groupId>
>>> <artifactId>io.infolayer.siteview-kar</artifactId>
>>> <version>4.2.7</version>
>>> <packaging>kar</packaging>
>>> <name>Siteview :: KAR</name>
>>> <build>
>>> <pluginManagement>
>>> <plugins>
>>> <plugin>
>>> <groupId>org.apache.karaf.tooling</groupId>
>>> <artifactId>karaf-maven-plugin</artifactId>
>>> <version>${project.version}</version>
>>> <extensions>true</extensions>
>>> </plugin>
>>> </plugins>
>>> </pluginManagement>
>>> <plugins>
>>> <plugin>
>>> <groupId>org.apache.karaf.tooling</groupId>
>>> <artifactId>karaf-maven-plugin</artifactId>
>>> </plugin>
>>> </plugins>
>>> </build>
>>> <dependencies>
>>> <dependency>
>>> <groupId>org.mongodb</groupId>
>>> <artifactId>mongo-java-driver</artifactId>
>>> <version>3.11.0</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>com.google.code.gson</groupId>
>>> <artifactId>gson</artifactId>
>>> <version>2.8.5</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>commons-io</groupId>
>>> <artifactId>commons-io</artifactId>
>>> <version>2.6</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>org.apache.commons</groupId>
>>> <artifactId>commons-lang3</artifactId>
>>> <version>3.9</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>org.apache.commons</groupId>
>>> <artifactId>commons-text</artifactId>
>>> <version>1.8</version>
>>> </dependency>
>>> </dependencies>
>>> </project>
>>
>> --
>> Jean-Baptiste Onofré
>> [email protected]
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>
--
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com