Hi,

You can put a file named assembly-property-edits.xml in the
src/main/karaf of the assembly module of your custom distribution.

the operation put update an existing value and extend add a new value in
the file specified by the file tag.

exemple of file :

<?xml version="1.0" encoding="UTF-8"?>
<!--
     * Specify an XML file that instructs this goal to apply edits to
     * one or more standard Karaf property files.
     * The contents of this file are documented in detail on
     * <a href="karaf-property-instructions-model.html">this page</a>.
     * This allows you to
     * customize these files without making copies in your resources
     * directories. Here's a simple example:
     * <pre>
     * -->
      <property-edits
xmlns="http://karaf.apache.org/tools/property-edits/1.0.0";>
         <edits>
          <edit>
            <file>config.properties</file>
            <operation>put</operation>
            <key>karaf.framework</key>
            <value>equinox</value>
          </edit>
          <edit>
            <file>config.properties</file>
            <operation>extend</operation>
            <key>org.osgi.framework.system.capabilities</key>
            <value>my-magic-capability</value>
          </edit>
          <edit>
            <file>config.properties</file>
            <operation prepend='true'>extend</operation>
            <key>some-other-list</key>
            <value>my-value-goes-first</value>
            </edit>
         </edits>
      </property-edits>

you can also include file in the resource directory (etc for example)
using the maven-resources-plugin by puting file in the
src/main/resources of the assemby module of your distribution :

    <!-- if you want to include resources in the distribution -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.0.2</version>
                <executions>
                    <execution>
                        <id>process-resources</id>
                        <goals>
                            <goal>resources</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>



Francois

Le 21/02/2018 à 20:39, SvS a écrit :
> I try to create a custom distribution with modified configuration files and
> see the following problems:
>
> 1. Modifications of the configuration (with profiles and also
> KarafPropertyEdits)  are overwritten with the configuration part (<config>..
> .</config>)  defined in the feature file. I assume that's not the intention.
> (See  code Builder
> <https://github.com/apache/karaf/blob/8e6649f2bd6754bf280ff1d6ddf279543f2c250e/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java#L924>
>  
> ). It is impossible to change the configuration with the
> karaf-maven-plugin:assembly for a custom distribution;
> 2. Would not it be nice when the configuration files <configfile
> finalname=mvn ..../> also placed in the etc directory of the custom
> distribution? Same as the internal configuration specified in the feature
> files (and not only installed to the system directory). Than other tools can
> use those files directly after copy the distribution to the production
> environment.
>
> Environment:
> •     Windows 7;
> •     Karaf 4.1.5;
>
> Problems also available in 4.2.0.M2 and 4.1.0 – 4.1.5.
>
> Will I make incidents or am I wrong?
>
>
>
>
> -----
> Regards,
> SvS
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Reply via email to