Agree with François ;)

I spent time on the user guide to describe this.

Now, we are working on a way better dev guide.

Regards
JB

On 02/02/2018 12:03 PM, Francois Papon wrote:
> For approach 2, it's explain in the documentation :
> http://karaf.apache.org/manual/latest/#_maven_assembly
> 
> under the Minimal Dirstribution Example :
> 
>     <build>
>         <!-- if you want to include resources in the distribution -->
>         <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>
>       ...
> 
> I hope it help ;)
> 
> François
> 
> 
> Le 02/02/2018 à 14:57, Francois Papon a écrit :
>>
>> Hi Nino,
>>
>> For me, this work in assembly project structure :
>>
>> putting configuration files in etc assembly source folder :
>>
>> *assembly/src/main/resources/etc*
>>
>> all files under this directory will be include by the karaf-maven-plugin.
>>
>> François
>>
>> Le 02/02/2018 à 14:11, nino martinez wael a écrit :
>>> Hi Jean
>>>
>>> I cannot share the project.. But I can give you some fragments:
>>>
>>> Project structure (assembly)
>>> https://imgur.com/a/c8RUG
>>>
>>> C:.
>>> └───main
>>>     ├───distribution
>>>     │   └───text
>>>     │       └───etc
>>>     │                  | -----> dk.netdesign.dialer.cfg this is the config
>>> file I want in etc folder
>>>     └───java
>>>         └───dk
>>>             └───netdesign
>>>                 └───osgidialer
>>>                     └───dialer
>>>                         └───karaf
>>>                             └───assembly
>>>
>>>
>>> Pom file
>>>
>>> <plugin>
>>>     <groupId>org.apache.karaf.tooling</groupId>
>>>     <artifactId>karaf-maven-plugin</artifactId>
>>>     <extensions>true</extensions>
>>>     <version>4.2.0.M2</version>
>>>     <configuration>
>>>         <installedFeatures>
>>>             <feature>wrapper</feature>
>>>             <feature>cxf</feature>
>>>             <feature>osgi-dialer</feature>
>>>         </installedFeatures>
>>>         <bootFeatures>
>>>             <feature>webconsole</feature>
>>>             <feature>eventadmin</feature>
>>>             <feature>wrap</feature>
>>>             <feature>aries-blueprint</feature>
>>>             <feature>shell</feature>
>>>             <feature>shell-compat</feature>
>>>             <feature>feature</feature>
>>>             <feature>jaas</feature>
>>>             <feature>ssh</feature>
>>>             <feature>management</feature>
>>>             <feature>bundle</feature>
>>>             <feature>config</feature>
>>>             <feature>deployer</feature>
>>>             <feature>diagnostic</feature>
>>>             <feature>feature</feature>
>>>             <feature>instance</feature>
>>>             <feature>kar</feature>
>>>             <feature>log</feature>
>>>             <feature>package</feature>
>>>             <feature>service</feature>
>>>             <feature>system</feature>
>>>         </bootFeatures>
>>>         <javase>1.8</javase>
>>>     </configuration>
>>> </plugin>
>>>
>>>
>>> What am I missing, resource plugin or something that actually grabs the .cfg
>>> file?
>>>
>>> regards Nino
>>>
>>>
>>>
>>>
>>>
>>> On Fri, Feb 2, 2018 at 10:48 AM, Jean-Baptiste Onofré <j...@nanthrax.net
>>> <mailto:j...@nanthrax.net>> wrote:
>>>
>>>     For a custom distro, you have two approaches:
>>>
>>>     - using the resource approach, where you have cfg file in a project 
>>> resource
>>>     folder. For this you have to use the resources or assembly plugins for
>>>     instance
>>>     (as execution step).
>>>     - using <config/> in features.xml used for the assembly, using the karaf
>>>     plugin
>>>
>>>     If you can share your project, I can fix stuff for you.
>>>
>>>     Regards
>>>     JB
>>>
>>>     On 02/02/2018 10:39 AM, nino martinez wael wrote:
>>>     > Yeah so I must be doing something wrong, I know that.. And of course
>>>     the maven
>>>     > properties are parsed so project.version are replaced with the correct
>>>     stuff..
>>>     >
>>>     > What about Approach 2 ? Are there any special steps needed? When
>>>     putting the
>>>     > config files into the etc folder for a custom distribtion?
>>>     >
>>>     >
>>>     >
>>>     > On Fri, Feb 2, 2018 at 10:20 AM, Jean-Baptiste Onofré 
>>> <j...@nanthrax.net
>>>     <mailto:j...@nanthrax.net>
>>>     > <mailto:j...@nanthrax.net <mailto:j...@nanthrax.net>>> wrote:
>>>     >
>>>     >     Hi,
>>>     >
>>>     >     I confirm it works as it's what we are using in Decanter or 
>>> Cellar,
>>>     or even
>>>     >     Karaf itself.
>>>     >
>>>     >     1. configfile:
>>>     >
>>>     >   
>>>      
>>> https://github.com/jbonofre/karaf-decanter/blob/master/assembly/src/main/feature/feature.xml#L48
>>>     
>>> <https://github.com/jbonofre/karaf-decanter/blob/master/assembly/src/main/feature/feature.xml#L48>
>>>     >   
>>>      
>>> <https://github.com/jbonofre/karaf-decanter/blob/master/assembly/src/main/feature/feature.xml#L48
>>>     
>>> <https://github.com/jbonofre/karaf-decanter/blob/master/assembly/src/main/feature/feature.xml#L48>>
>>>     >
>>>     >     Here the files will end into the etc folder when you feature is
>>>     installed.
>>>     >
>>>     >     Of course, the concrete feature has to be resolved that way
>>>     >   
>>>      
>>> (http://repo.maven.apache.org/maven2/org/apache/karaf/decanter/apache-karaf-decanter/1.4.0/apache-karaf-decanter-1.4.0-features.xml
>>>     
>>> <http://repo.maven.apache.org/maven2/org/apache/karaf/decanter/apache-karaf-decanter/1.4.0/apache-karaf-decanter-1.4.0-features.xml>
>>>     >   
>>>      
>>> <http://repo.maven.apache.org/maven2/org/apache/karaf/decanter/apache-karaf-decanter/1.4.0/apache-karaf-decanter-1.4.0-features.xml
>>>     
>>> <http://repo.maven.apache.org/maven2/org/apache/karaf/decanter/apache-karaf-decanter/1.4.0/apache-karaf-decanter-1.4.0-features.xml>>):
>>>     >
>>>     >     <configfile
>>>     finalname="/etc/org.apache.karaf.decanter.collector.log.cfg">
>>>     >   
>>>      
>>> mvn:org.apache.karaf.decanter.collector/org.apache.karaf.decanter.collector.log/1.4.0/cfg
>>>     >     </configfile>
>>>     >
>>>     >     So I hope you don't have ${project.version} in the URL and the
>>>     Karaf system
>>>     >     folder or .m2/repository or remote repo contains:
>>>     >
>>>     >   
>>>      
>>> dk/netdesign/osgi-dialer/osgi-dialer-backend/xx/osgi-dialer-backend-xx-configuration.cfg
>>>     >
>>>     >
>>>     >     2. confg works also, but it depnds of the Karaf version you are
>>>     using. In the
>>>     >     past, we didn't created the cfg file corresponding to <config/>.
>>>     "Recently", we
>>>     >     changed to write the file.
>>>     >
>>>     >     Regards
>>>     >     JB
>>>     >
>>>     >     On 02/02/2018 10:15 AM, nino martinez wael wrote:
>>>     >     > Hi fellow karaflings
>>>     >     >
>>>     >     > I want to either prepackage or install my configuration files
>>>     into the etc
>>>     >     > folder of karaf  when my feature installs.
>>>     >     >
>>>     >     > I've tried a couple of different approaches, which all fails :(
>>>     They fail in the
>>>     >     > way that the configuration gets bound to the bundles mvn
>>>     coordinates and are not
>>>     >     > placed into the etc folder
>>>     >     >
>>>     >     > *Approach 1 Feature file*
>>>     >     >
>>>     >     > The following to techniques are supposed to place my
>>>     configuration files into
>>>     >     > the etc folder
>>>     >     >
>>>     >     > Using the configfile element, 
>>>     >     >
>>>     >     > <feature>
>>>     >     >
>>>     >     > ...
>>>     >     >
>>>     >     > <configfile
>>>     
>>> finalname="/etc/dk.netdesign.dialer.cfg">mvn:dk.netdesign.osgi-dialer/osgi-dialer-backend/${project.version}/cfg/configuration</configfile>
>>>     >     >
>>>     >     > ...
>>>     >     >
>>>     >     > </feature>
>>>     >     >
>>>     >     >
>>>     >     >
>>>     >     >
>>>     >     > Using the config element
>>>     >     >
>>>     >     > <feature>
>>>     >     >
>>>     >     > ...
>>>     >     >
>>>     >     > <config name="dk.netdesign.dialer">
>>>     >     >
>>>     >     > myobscurepropperty=ILoveKaraf:)
>>>     >     >
>>>     >     > </config>
>>>     >     >
>>>     >     > ...
>>>     >     >
>>>     >     > </feature>
>>>     >     >
>>>     >     >
>>>     >     > *Approach 2 Karaf distribution with the karaf assembly plugin 
>>> for
>>>     maven /
>>>     >     prefered*
>>>     >     >
>>>     >     > This approach will have the benefit of me being able to put in
>>>     >     configurations for some of the features / bundles that I do not 
>>> control
>>>     >     >
>>>     >     > C:.
>>>     >     > └───main
>>>     >     >     ├───distribution
>>>     >     >     │   └───text
>>>     >     >     │       └───etc
>>>     >     >     └───java
>>>     >     >         └───dk
>>>     >     >             └───netdesign
>>>     >     >                 └───osgidialer
>>>     >     >                     └───dialer
>>>     >     >                         └───karaf
>>>     >     >                             └───assembly
>>>     >     >
>>>     >     > In the etc folder I've placed my configuration file... But they
>>>     never show
>>>     >     up in
>>>     >     > my karaf distribution.. I've done nothing special in the 
>>> assembly
>>>     plugin, I
>>>     >     > wonder what I am doing wrong?
>>>     >     >
>>>     >     > --
>>>     >     > Best regards / Med venlig hilsen 
>>>     >     > Nino Martinez
>>>     >
>>>     >     --
>>>     >     Jean-Baptiste Onofré
>>>     >     jbono...@apache.org <mailto:jbono...@apache.org>
>>>     <mailto:jbono...@apache.org <mailto:jbono...@apache.org>>
>>>     >     http://blog.nanthrax.net
>>>     >     Talend - http://www.talend.com
>>>     >
>>>     >
>>>     >
>>>     >
>>>     > --
>>>     > Best regards / Med venlig hilsen 
>>>     > Nino Martinez
>>>
>>>     --
>>>     Jean-Baptiste Onofré
>>>     jbono...@apache.org <mailto:jbono...@apache.org>
>>>     http://blog.nanthrax.net
>>>     Talend - http://www.talend.com
>>>
>>>
>>>
>>>
>>> -- 
>>> Best regards / Med venlig hilsen 
>>> Nino Martinez
>>
> 

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

Reply via email to