You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Mike Rumpf <mi...@gmx.de> on 2016/03/01 12:39:42 UTC

Re: Issue building with karaf-maven-plugin

The correct way is to work with feature dependencies, e.g.



(in the \src\main\feature\feature.xml)

Than the resolver will be able to resolve the missing dependencies. However
from my experience setting the *prerequisite* property to *true *will lead
to various build errors. (Don't know if you did that though).

You also might need to use Maven-Excludes in your feature-pom to avoid some
dependency-pitfalls.

If you add your features to the boot-features in the assembly they won't be
verified (contrary to being listed under startup features). Avoid non-osgi
bundles in your features. (This would lead to the wrap feature being
verified and the build will fail because of missing log-implementation...)

The Karaf-Maven-Plugin is quite tricky to configure right.

Hope that helps,
Mike




--
View this message in context: http://karaf.922171.n3.nabble.com/Issue-building-with-karaf-maven-plugin-tp4045602p4045642.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Issue building with karaf-maven-plugin

Posted by David Daniel <da...@gmail.com>.
I currently only have capabilities and requirements in my bundles manifest
and will be adding them to my features.  Thank you for the example.  I have
been making progress and the validation has been useful.  I thought I was
good because everything runs in pax exam and my old way of building a
custom karaf distribution worked but validation is finding things I did not
know about.  Here is the start of my features file that I have now that I
am working through the issues with.

<features name="aardvark"  xmlns="
http://karaf.apache.org/xmlns/features/v1.3.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.3.0
http://karaf.apache.org/xmlns/features/v1.3.0">
    <feature name="frameworkcapabilities" description="Felix Requirements
For AARDVARK" version="1.0.0">
        <feature prerequisite="true">framework</feature>
        <capability>osgi.ee;effective:=active;osgi.ee
="JavaSE";version="1.8"</capability>

<capability>osgi.service;effective:=active;objectClass="org.osgi.service.log.LogService"</capability>
    </feature>
    <feature name="aardvarkfelixbundles" description="Felix Requirements
For AARDVARK" version="1.0.0">
        <feature prerequisite="true">frameworkcapabilities</feature>
        <bundle>mvn:javax.servlet/javax.servlet-api/3.1.0</bundle>

<bundle>mvn:org.apache.felix/org.apache.felix.http.api/3.0.0</bundle>

<bundle>mvn:org.apache.felix/org.apache.felix.coordinator/1.0.2</bundle>

<bundle>mvn:org.apache.felix/org.apache.felix.eventadmin/1.4.4</bundle>

<bundle>mvn:org.apache.felix/org.apache.felix.metatype/1.1.2</bundle>
    </feature>
    <feature name="aardvarkconfigurerbundles" description="Configuration
Requirements For AARDVARK" version="1.0.0">
        <feature prerequisite="true">aardvarkfelixbundles</feature>

<bundle>mvn:org.osgi/osgi.configurer.provider/1.0.0.201404171643</bundle>
        <bundle>mvn:osgi.enroute/configurer.simple.provider/1.2.2</bundle>
    </feature>
    <feature name="aardvarkhttpbundles" description="HTTP Requirements For
AARDVARK" version="1.0.0">
        <feature prerequisite="true">scr</feature>
        <feature prerequisite="true">aardvarkconfigurerbundles</feature>

<bundle>mvn:org.apache.felix/org.apache.felix.http.servlet-api/1.1.2</bundle>

<bundle>mvn:org.apache.felix/org.apache.felix.http.base/3.0.4</bundle>

<bundle>mvn:org.apache.felix/org.apache.felix.http.whiteboard/3.0.0</bundle>

<bundle>mvn:org.apache.felix/org.apache.felix.http.jetty/3.1.4</bundle>
        <bundle>mvn:org.apache.httpcomponents/httpcore-osgi/4.4.4</bundle>
        <bundle>mvn:org.apache.httpcomponents/httpclient-osgi/4.5.1</bundle>
        <bundle>mvn:osgi.enroute/dto.bndlib.provider/1.0.0</bundle>
        <bundle>mvn:osgi.enroute/web.simple.provider/1.3.3</bundle>
        <bundle>mvn:osgi.enroute/executor.simple.provider/1.0.0</bundle>
    </feature>

A sample issue that the validator found is
DEBUG] Candidate permutation failed due to a conflict between imports; will
try another if possible. (Uses constraint violation. Unable to resolve
resource com.eclipsesource.jaxrs.publisher
[com.eclipsesource.jaxrs.publisher/5.3.0.201512270850] because it is
exposed to package 'javax.servlet.http' from resources javax.servlet-api
[javax.servlet-api/3.1.0] and org.apache.felix.http.servlet-api
[org.apache.felix.http.servlet-api/1.1.2] via two dependency chains.

Chain 1:
  com.eclipsesource.jaxrs.publisher
[com.eclipsesource.jaxrs.publisher/5.3.0.201512270850]
    import:
(&(osgi.wiring.package=javax.servlet.http)(version>=2.3.0)(!(version>=4.0.0)))
     |
    export: osgi.wiring.package: javax.servlet.http
  javax.servlet-api [javax.servlet-api/3.1.0]

Chain 2:
  com.eclipsesource.jaxrs.publisher
[com.eclipsesource.jaxrs.publisher/5.3.0.201512270850]
    import:
(&(osgi.wiring.package=org.osgi.service.http)(version>=1.2.0)(!(version>=2.0.0)))
     |
    export: osgi.wiring.package=org.osgi.service.http;
uses:=javax.servlet.http
  org.apache.felix.http.api [org.apache.felix.http.api/3.0.0]
    import:
(&(osgi.wiring.package=javax.servlet.http)(version>=3.1.0)(!(version>=4.0.0)))
     |
    export: osgi.wiring.package: javax.servlet.http
  org.apache.felix.http.servlet-api
[org.apache.felix.http.servlet-api/1.1.2])

because I am including
<bundle>mvn:org.apache.felix/org.apache.felix.http.servlet-api/1.1.2</bundle>
and  <bundle>mvn:javax.servlet/javax.servlet-api/3.1.0</bundle>.  This
problem never showed itself before but I can see how it would be an issue.

On Tue, Mar 1, 2016 at 9:05 AM, Mike Rumpf <mi...@gmx.de> wrote:

> Capabalities are evaluated in both directions. That works fine in my
> environment.
>
> A Feature example with capability could look like this:
>
>
>
> Did you try to add the log dependency as in above example?
>
> Can you post your feature definition?
>
> Mike
>
>
> David Daniel wrote
> > I think I have figured out where I was going wrong.  If I include
> > framework
> > as a prerequisite then it gives me an error message that I believe is
> more
> > accurate.
> >
> > [ERROR] Failed to execute goal
> > org.apache.karaf.tooling:karaf-maven-plugin:4.0.4:assembly
> > (default-assembly) on project server-installer: Unable to build assembly:
> > Unable to resolve root: missing requirement [root] osgi.identity;
> > osgi.identity=aardvarkconfigurerbundles; type=karaf.feature; version=0;
> >
> filter:="(&(osgi.identity=aardvarkconfigurerbundles)(type=karaf.feature)(version>=0.0.0))"
> > [caused by: Unable to resolve aardvarkconfigurerbundles/1.0.0: missing
> > requirement [aardvarkconfigurerbundles/1.0.0] osgi.identity;
> > osgi.identity=osgi.enroute.configurer.simple.provider; type=osgi.bundle;
> > version="[1.2.2.201509211431,1.2.2.201509211431]"; resolution:=mandatory
> > [caused by: Unable to resolve
> > osgi.enroute.configurer.simple.provider/1.2.2.201509211431: missing
> > requirement [osgi.enroute.configurer.simple.provider/1.2.2.201509211431]
> > osgi.service; filter:="(objectClass=org.osgi.service.log.LogService)";
> > effective:=active]] -> [Help 1]
> >
> > I am using the 1.3.0 version of features and that has the ability to add
> > requirements and capabilities.
> >
> http://karaf.apache.org/manual/latest/users-guide/provisioning-schema.html
> > I am wondering if the veriffier is taking the requirements out of the
> > bundles but is not taking the capabilities out of the bundles.  I was
> > hoping that if I put a dummy frameworkcapabilities feature in that just
> > specified that it has the capabilities that the verifier feels it is
> > missing then I might be ok.  Does anyone have a framework 1.3.0 sample
> > with
> > requirements and capabilities.
> >
> > On Tue, Mar 1, 2016 at 6:39 AM, Mike Rumpf &lt;
>
> > mikey99@
>
> > &gt; wrote:
> >
> >> The correct way is to work with feature dependencies, e.g.
> >>
> >>
> >>
> >> (in the \src\main\feature\feature.xml)
> >>
> >> Than the resolver will be able to resolve the missing dependencies.
> >> However
> >> from my experience setting the *prerequisite* property to *true *will
> >> lead
> >> to various build errors. (Don't know if you did that though).
> >>
> >> You also might need to use Maven-Excludes in your feature-pom to avoid
> >> some
> >> dependency-pitfalls.
> >>
> >> If you add your features to the boot-features in the assembly they won't
> >> be
> >> verified (contrary to being listed under startup features). Avoid
> >> non-osgi
> >> bundles in your features. (This would lead to the wrap feature being
> >> verified and the build will fail because of missing
> >> log-implementation...)
> >>
> >> The Karaf-Maven-Plugin is quite tricky to configure right.
> >>
> >> Hope that helps,
> >> Mike
> >>
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://karaf.922171.n3.nabble.com/Issue-building-with-karaf-maven-plugin-tp4045602p4045642.html
> >> Sent from the Karaf - User mailing list archive at Nabble.com.
> >>
>
>
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Issue-building-with-karaf-maven-plugin-tp4045602p4045649.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

Re: Issue building with karaf-maven-plugin

Posted by Mike Rumpf <mi...@gmx.de>.
Capabalities are evaluated in both directions. That works fine in my
environment.

A Feature example with capability could look like this:



Did you try to add the log dependency as in above example?

Can you post your feature definition?

Mike


David Daniel wrote
> I think I have figured out where I was going wrong.  If I include
> framework
> as a prerequisite then it gives me an error message that I believe is more
> accurate.
> 
> [ERROR] Failed to execute goal
> org.apache.karaf.tooling:karaf-maven-plugin:4.0.4:assembly
> (default-assembly) on project server-installer: Unable to build assembly:
> Unable to resolve root: missing requirement [root] osgi.identity;
> osgi.identity=aardvarkconfigurerbundles; type=karaf.feature; version=0;
> filter:="(&(osgi.identity=aardvarkconfigurerbundles)(type=karaf.feature)(version>=0.0.0))"
> [caused by: Unable to resolve aardvarkconfigurerbundles/1.0.0: missing
> requirement [aardvarkconfigurerbundles/1.0.0] osgi.identity;
> osgi.identity=osgi.enroute.configurer.simple.provider; type=osgi.bundle;
> version="[1.2.2.201509211431,1.2.2.201509211431]"; resolution:=mandatory
> [caused by: Unable to resolve
> osgi.enroute.configurer.simple.provider/1.2.2.201509211431: missing
> requirement [osgi.enroute.configurer.simple.provider/1.2.2.201509211431]
> osgi.service; filter:="(objectClass=org.osgi.service.log.LogService)";
> effective:=active]] -> [Help 1]
> 
> I am using the 1.3.0 version of features and that has the ability to add
> requirements and capabilities.
> http://karaf.apache.org/manual/latest/users-guide/provisioning-schema.html
> I am wondering if the veriffier is taking the requirements out of the
> bundles but is not taking the capabilities out of the bundles.  I was
> hoping that if I put a dummy frameworkcapabilities feature in that just
> specified that it has the capabilities that the verifier feels it is
> missing then I might be ok.  Does anyone have a framework 1.3.0 sample
> with
> requirements and capabilities.
> 
> On Tue, Mar 1, 2016 at 6:39 AM, Mike Rumpf &lt;

> mikey99@

> &gt; wrote:
> 
>> The correct way is to work with feature dependencies, e.g.
>>
>>
>>
>> (in the \src\main\feature\feature.xml)
>>
>> Than the resolver will be able to resolve the missing dependencies.
>> However
>> from my experience setting the *prerequisite* property to *true *will
>> lead
>> to various build errors. (Don't know if you did that though).
>>
>> You also might need to use Maven-Excludes in your feature-pom to avoid
>> some
>> dependency-pitfalls.
>>
>> If you add your features to the boot-features in the assembly they won't
>> be
>> verified (contrary to being listed under startup features). Avoid
>> non-osgi
>> bundles in your features. (This would lead to the wrap feature being
>> verified and the build will fail because of missing
>> log-implementation...)
>>
>> The Karaf-Maven-Plugin is quite tricky to configure right.
>>
>> Hope that helps,
>> Mike
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://karaf.922171.n3.nabble.com/Issue-building-with-karaf-maven-plugin-tp4045602p4045642.html
>> Sent from the Karaf - User mailing list archive at Nabble.com.
>>





--
View this message in context: http://karaf.922171.n3.nabble.com/Issue-building-with-karaf-maven-plugin-tp4045602p4045649.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Issue building with karaf-maven-plugin

Posted by David Daniel <da...@gmail.com>.
I think I have figured out where I was going wrong.  If I include framework
as a prerequisite then it gives me an error message that I believe is more
accurate.

[ERROR] Failed to execute goal
org.apache.karaf.tooling:karaf-maven-plugin:4.0.4:assembly
(default-assembly) on project server-installer: Unable to build assembly:
Unable to resolve root: missing requirement [root] osgi.identity;
osgi.identity=aardvarkconfigurerbundles; type=karaf.feature; version=0;
filter:="(&(osgi.identity=aardvarkconfigurerbundles)(type=karaf.feature)(version>=0.0.0))"
[caused by: Unable to resolve aardvarkconfigurerbundles/1.0.0: missing
requirement [aardvarkconfigurerbundles/1.0.0] osgi.identity;
osgi.identity=osgi.enroute.configurer.simple.provider; type=osgi.bundle;
version="[1.2.2.201509211431,1.2.2.201509211431]"; resolution:=mandatory
[caused by: Unable to resolve
osgi.enroute.configurer.simple.provider/1.2.2.201509211431: missing
requirement [osgi.enroute.configurer.simple.provider/1.2.2.201509211431]
osgi.service; filter:="(objectClass=org.osgi.service.log.LogService)";
effective:=active]] -> [Help 1]

I am using the 1.3.0 version of features and that has the ability to add
requirements and capabilities.
http://karaf.apache.org/manual/latest/users-guide/provisioning-schema.html
I am wondering if the veriffier is taking the requirements out of the
bundles but is not taking the capabilities out of the bundles.  I was
hoping that if I put a dummy frameworkcapabilities feature in that just
specified that it has the capabilities that the verifier feels it is
missing then I might be ok.  Does anyone have a framework 1.3.0 sample with
requirements and capabilities.

On Tue, Mar 1, 2016 at 6:39 AM, Mike Rumpf <mi...@gmx.de> wrote:

> The correct way is to work with feature dependencies, e.g.
>
>
>
> (in the \src\main\feature\feature.xml)
>
> Than the resolver will be able to resolve the missing dependencies. However
> from my experience setting the *prerequisite* property to *true *will lead
> to various build errors. (Don't know if you did that though).
>
> You also might need to use Maven-Excludes in your feature-pom to avoid some
> dependency-pitfalls.
>
> If you add your features to the boot-features in the assembly they won't be
> verified (contrary to being listed under startup features). Avoid non-osgi
> bundles in your features. (This would lead to the wrap feature being
> verified and the build will fail because of missing log-implementation...)
>
> The Karaf-Maven-Plugin is quite tricky to configure right.
>
> Hope that helps,
> Mike
>
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Issue-building-with-karaf-maven-plugin-tp4045602p4045642.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>