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

     http://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.
////

[*__since 2.3__*]

From a set of jar artifacts, this task generates an OBR (OSGi Bundle Repository) descriptor. It could be then used by the link:../resolver/obr{outfilesuffix}[obr resolver].

The set of jars which will be described by OBR can be defined in 4 mutually exclusive ways:

* via an Ivy resolver: every jar listed by the resolver will be taken into account
* by defining a root directory: every jar found recursively in that folder will be taken into account
* via the name of an Ivy cache: every artifact contained in the cache will be taken into account
* (*__since 2.4__*) via a resolve: this task is a link:../use/postresolvetask{outfilesuffix}[post resolve task] (with all the behaviour and attributes common to all post resolve tasks), thus every artifact which has been resolved will be taken into account; it is especially useful for building a link:../osgi/target-platform{outfilesuffix}[target platform]

NB: among every listed file or artifact, only the actually OSGi bundles will be described by the OBR descriptor; the other files are ignored.

== Attributes

[*__since 2.4__*]

This is a link:../use/postresolvetask{outfilesuffix}[post resolve task], with all the behaviour and attributes common to all post resolve tasks.

[options="header",cols="15%,50%,35%"]
|=======
|Attribute|Description|Required
|out|the location of the descriptor file to generate|Yes
|resolverName|the name of the resolver from which the jars should be to gathered|No
|cacheName|the name of the cache from which the jars should be to gathered|No
|baseDir|the folder into which the jars should be gathered recursively|No
|sourceType|if used as a post resolve task, `sourceType` defines the type of artifacts which should be considered as source artifacts|No. Defaults to `source,sources,src`
|encoding|The encoding of the resulting XML file|No. Defaults to `UTF-8`
|indent|Specify if the XML result file should be indented|No. Defaults to `true`
|quiet|Log the rejected jars that are ill-formed as debug rather than warning|No. Defaults to `false`
|=======

== Examples

[source,xml]
----
    <ivy:buildobr baseDir="${eclipse.home}" out="${basedir}/target/repo-eclipse.xml" indent="true"/>
----

Builds an indented OBR descriptor from an Eclipse install, with their path relative to the Eclipse install.

'''

[source,xml]
----
    <ivy:configure file="ivysettings.xml"/>
    <ivy:buildobr resolverName="my-file-resolver" out="${basedir}/target/repo-eclipse.xml"/>
----

Configures Ivy settings and builds an OBR descriptor from jars resolved by the defined resolver.

'''

[source,xml]
----
    <ivy:configure file="ivysettings.xml"/>
    <ivy:buildobr cacheName="my-cache" out="${basedir}/target/repo-eclipse.xml"/>
----

Configures Ivy settings and builds an OBR descriptor from jars contained in the defined cache.

'''

[source,xml]
----
    <ivy:configure file="ivysettings.xml"/>
    <ivy:resolve file="ivy.xml"/>
    <ivy:buildobr out="${basedir}/target-platform-obr.xml"/>
----

Launches a resolve and then builds an obr.xml describing the resolved artifacts.
