////
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
   distributed with this work for additional information
   regarding copyright ownership.  The ASF licenses this file
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
   with the License.  You may obtain a copy of the License at

     https://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   KIND, either express or implied.  See the License for the
   specific language governing permissions and limitations
   under the License.
////

= OSGi Bundle Repository

[]
|=======
|Tag|obr
|Handle latest|yes
|Handle publish|no
|=======


[*__since 2.3__*]

[ivysettings.resolvers.obr]#This resolver is one of the resolver which supports link:../osgi{outfilesuffix}[OSGi(TM)] dependencies.# A part of the OSGi specification defines OBR (OSGi Bundle Repository). OBR aggregates the OSGi metadata of every bundle included in a repository. So contrary to the other resolvers, this resolver needs to get the descriptor of the repository (an obr.xml) before starting to resolve modules.


== Attributes

This resolver shares the link:../settings/resolvers{outfilesuffix}#common[common attributes] of composite resolvers.

[options="header",cols="15%,50%,35%"]
|=======
|Attribute|Description|Required
|repoXmlURL|the URL of the obr.xml to load.|Yes
|repoXmlFile|the local path of the obr.xml to load.|Yes
|requirementStrategy|defines how strict should be the OSGi resolution. Can be one of `first` or `noambiguity`|No, default to `noambiguity`
|metadataTtl|the time in milliseconds the obr.xml is considered up to date|No, default to 3600000 (1 hour)
|forceMetadataUpdate|force the update of the obr.xml without checking its freshness|No, default to false
|=======


The requirement strategy is defining how the resolver should behave when facing several choices. In the OSGi dependency model, an `Import-Package` requirement can be satisfied by several different bundles. So when resolving such requirement, Ivy will first look into the already resolved bundles if one provides that package. If it fails to find one, then two behaviours can occur:


    * if the requirement strategy is `first`, among the bundles satisfying the requirement, it will choose the first one. A warning will be logged about the choice Ivy has to arbitrarily do. +

    * if the requirement strategy is `noambiguity`, Ivy will make the resolution fail. +


== Examples


[source, xml]
----

<obr name="felix-repo" repoXmlURL="http://felix.apache.org/obr/releases.xml"/>

----

A simple repository configured to use the Felix OBR.

'''


[source, xml]
----

<obr name="my-osgi-repo" repoXmlFile="${ivy.settings.dir}/obr/obr.xml" requirementStrategy="first"/>

----

A local repository which is trusted to always provide correct dependency for the `Import-Package` requirements.
