[
https://issues.apache.org/jira/browse/KARAF-5372?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16280132#comment-16280132
]
Grzegorz Grzybek commented on KARAF-5372:
-----------------------------------------
Then, continuing work on ENTESB-5376 I implemented _overrides_ in a kind of
postprocessor of read features XML. So by defining overrides (in old
{{etc/overrides.properties}} or in new {{etc/org.apache.karaf.features.xml}}),
we can alter the repositories/features/bundles during assembly.
So having a custom startup KAR in Maven:
{code:xml}
<dependency>
<groupId>grgr.test.karaf.plugins</groupId>
<artifactId>my-kar</artifactId>
<version>0.1.0.BUILD-SNAPSHOT</version>
<type>kar</type>
</dependency>
{code}
And this fragment of {{karaf-maven-plugin:assembly}} configuration:
{code:xml}
<configuration>
<framework>custom</framework>
...
<startupFeatures>
<f>my-*-feature</f>
</startupFeatures>
...
{code}
And the definition of custom KAR's features (pax-logging-api 1.10.0):
{code:xml}
<features name="fuse-framework-${project.version}"
xmlns="http://karaf.apache.org/xmlns/features/v1.5.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.5.0
http://karaf.apache.org/xmlns/features/v1.5.0">
<feature name="my-startup-feature" version="${project.version}">
<bundle
start-level="1">mvn:org.apache.karaf.features/org.apache.karaf.features.extension/4.2.0-SNAPSHOT</bundle>
<bundle
start-level="2">mvn:org.ops4j.pax.logging/pax-logging-api/1.10.0</bundle>
<bundle
start-level="5">mvn:org.ops4j.pax.url/pax-url-aether/2.5.3</bundle>
</feature>
</features>
{code}
*and* new {{etc/org.apache.karaf.features.xml}} configuration with:
{code:xml}
<bundleReplacements>
<bundle replacement="mvn:org.ops4j.pax.logging/pax-logging-api/1.10.1"
mode="maven" />
</bundleReplacements>
{code}
We end up with:
{noformat}
[INFO] Startup stage
[INFO] Loading startup repositories
[INFO] Resolving startup features and bundles
[INFO] Features: my-*-feature
[INFO] Bundles: ...
...
[INFO] adding maven artifact:
mvn:org.ops4j.pax.logging/pax-logging-api/1.10.1
...
{noformat}
and proper {{etc/startup.properties}}:
{noformat}
# Bundles to be started on startup, with startlevel
mvn\:org.apache.karaf.features/org.apache.karaf.features.extension/4.2.0-SNAPSHOT
= 1
mvn\:org.ops4j.pax.logging/pax-logging-api/1.10.1 = 2
mvn\:org.ops4j.pax.url/pax-url-aether/2.5.3 = 5
{noformat}
{panel:title=Warning|borderColor=#c00|titleBGColor=#c00|titleColor=white}
_Overrides_ mechanism works at feature level. So it can be applied during
feature installation or assembly construction. After {{etc/startup.properties}}
is set, bundles defined there *can't* be overriden.
{panel}
> startup.properties doesn't respect overrides
> --------------------------------------------
>
> Key: KARAF-5372
> URL: https://issues.apache.org/jira/browse/KARAF-5372
> Project: Karaf
> Issue Type: Bug
> Components: karaf-tooling
> Affects Versions: 4.1.2
> Reporter: J. Brébec
> Assignee: Grzegorz Grzybek
>
> The karaf-maven-plugin doesn't take into account bundles overrides. The karaf
> main doesn't use it either. As a consequence, it is not possible to override
> core bundle as fileinstall or features-core
> For a real usecase, I was trying to patch locally KARAF-5371 (which is a
> blocker issue in my context), but it's not possible to override the
> feature-core bundle. I have to overwrite the jar with a patched version after
> the assembly goal..
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)