wav / osgi-tooling

Some tooling for OSGI in scala
Apache License 2.0
2 stars 1 forks source link

Karaf goes crazy with some option start and dependency #9

Open PhilAndrew opened 8 years ago

PhilAndrew commented 8 years ago

In the features.xml output it normally generates something like this with start="false" dependency="true", but this seems to make Karaf go crazy and Karaf keeps restarting again and again in a loop.

  <feature description="base_osgi3" version="1.0.0" name="base_osgi3">
    <bundle start="false" dependency="true">mvn:com.typesafe/config/1.2.1</bundle>
    <bundle start="false" dependency="true">wrap:mvn:org.uncommons.maths/uncommons-maths/1.2.2a</bundle>

However if I do this.

  <feature description="base_osgi3" version="1.0.0" name="base_osgi3">
    <bundle>mvn:com.typesafe/config/1.2.1</bundle>
    <bundle>wrap:mvn:org.uncommons.maths/uncommons-maths/1.2.2a</bundle>

Then Karaf starts and gives a meaningful error, which is good and useful, so then my question is how to get rid of the start="false" and dependency="true"?

    __ __                  ____
       / //_/____ __________ _/ __/
      / ,<  / __ `/ ___/ __ `/ /_
     / /| |/ /_/ / /  / /_/ / __/
    /_/ |_|\__,_/_/   \__,_/_/

  Apache Karaf (4.0.0)

Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown Karaf.

karaf@root()>
karaf@root()> feature:install base_osgi3
Error executing command: Unable to resolve root: missing requirement [root] osgi
.identity; osgi.identity=base_osgi3; type=karaf.feature; version="[1.0.0,1.0.0]"
; filter:="(&(osgi.identity=base_osgi3)(type=karaf.feature)(version>=1.0.0)(vers
ion<=1.0.0))" [caused by: Unable to resolve base_osgi3/1.0.0: missing requiremen
t [base_osgi3/1.0.0] osgi.identity; osgi.identity=slf4j.api; type=osgi.bundle; v
ersion="[1.7.5,1.7.5]"; resolution:=mandatory [caused by: Unable to resolve slf4
j.api/1.7.5: missing requirement [slf4j.api/1.7.5] osgi.wiring.package; filter:=
"(&(osgi.wiring.package=org.slf4j.impl)(version>=1.6.0))"]]
karaf@root()>
PhilAndrew commented 8 years ago

I guess it's around here

bject dependencyFormat extends XmlFormat[Dependency] {
def write(d: Dependency) = {
  Some(setAttrs(<feature>{d.name}</feature>, Map(
    "version" -> d.version.map(_.toString),
    "prerequisite" -> Some(d.prerequisite.toString),
    "dependency" -> Some(d.dependency.toString)
  )))
}

In https://github.com/wav/osgi-tooling/blob/master/karaf-packaging/src/main/scala/wav/devtools/karaf/packaging/FeaturesXmlFormats.scala

I'll look into this more today

wav commented 8 years ago

The bundle attributes start and dependency are set by default. I need to revisit this and make these more configurable at the time you declare the dependency. I'll investigate this further tonight.

I see: resolution:=mandatory [caused by: Unable to resolve slf4j.api/1.7.5: missing requirement [slf4j.api/1.7.5]

Could you post your full features file for testing?

Cheers.

PhilAndrew commented 8 years ago

Currently my features file is working as I changed things around, I'll try to get back the older one a bit later.

wav commented 8 years ago

Ok. I've had a look, the issue appears to be the scope for which I select the dependencies, they are taken from the "runtime" scope, which is contrary to:

Re: http://karaf.922171.n3.nabble.com/What-version-of-slf4j-is-provided-in-karaf-td4041602.html jbonofre: You can defined the dependency as runtime, like this, the karaf feature plugin won't take it in the generated features.xml.