You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Martin Nielsen <mn...@gmail.com> on 2018/07/11 09:15:47 UTC

How do i change a single line in a custom distro file?

Hello everyone

I am trying to override the service requrements enforcement for my custom
distribution. I am using the <packaging>karaf-assembly</packaging> in my
POM to create the assembly.

Inside the org.apache.karaf.features.cfg i want to set the
serviceRequirements config to disable.
The config file contains these lines:

#
# Service requirements enforcement
#
# By default, the feature resolver checks the service
requirements/capabilities of
# bundles for new features (xml schema >= 1.3.0) in order to automatically
installs
# the required bundles.
# The following flag can have those values:
#   - disable: service requirements are completely ignored
#   - default: service requirements are ignored for old features
#   - enforce: service requirements are always verified
#
#serviceRequirements=default

How do i tell the karaf-assembly to change this line in a smooth manner? I
can't just override the entire file, as the file is generated based on the
feature dependencies in my POM. The file contains the featuresRepositories
and featuresBoot options as well, and since those are managed by the
plugin, overriding the entire file would lead to problems down the road
when i start changing versions/scopes in my POM file.

Is there a clever way to tell the karaf-assembly to change that specific
line and leave the rest of the file intact?

-Martin

Re: How do i change a single line in a custom distro file?

Posted by Francois Papon <fr...@openobject.fr>.
Hi Martin,

You can use the property edits feature.

You have to create a file in src/main/karaf/assembly-property-edits.xml
of your assembly module and build your assembly.

Here an example :

<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>

regards,

François


Le 11/07/2018 à 13:15, Martin Nielsen a écrit :
> Hello everyone
>
> I am trying to override the service requrements enforcement for my
> custom distribution. I am using
> the <packaging>karaf-assembly</packaging> in my POM to create the
> assembly.
>
> Inside the org.apache.karaf.features.cfg i want to set the
> serviceRequirements config to disable.
> The config file contains these lines:
>
> #
> # Service requirements enforcement
> #
> # By default, the feature resolver checks the service
> requirements/capabilities of
> # bundles for new features (xml schema >= 1.3.0) in order to
> automatically installs
> # the required bundles.
> # The following flag can have those values:
> #   - disable: service requirements are completely ignored
> #   - default: service requirements are ignored for old features
> #   - enforce: service requirements are always verified
> #
> #serviceRequirements=default
>
> How do i tell the karaf-assembly to change this line in a smooth
> manner? I can't just override the entire file, as the file is
> generated based on the feature dependencies in my POM. The file
> contains the featuresRepositories and featuresBoot options as well,
> and since those are managed by the plugin, overriding the entire file
> would lead to problems down the road when i start changing
> versions/scopes in my POM file.
>
> Is there a clever way to tell the karaf-assembly to change that
> specific line and leave the rest of the file intact?
>
> -Martin


Re: How do i change a single line in a custom distro file?

Posted by Markus Rathgeb <ma...@gmail.com>.
Have you already tried "assembly-property-edits.xml" in the
"src/main/karaf" folder of your custom distribution?
I don't find the official documentation, but you can found examples using a
search engine of your choose ;)