and used from XQuery, and how new packages can be built.
==Motivation==
One of the reasons why languages such as Java or Perl have been so successful is the vast amount of libraries that are available to developers.
A package is defined as a {{Mono|.xar}} archive, which encapsulates one or more extension libraries.
==Usage==
All packages are stored in the package repository. The repository is a directory named {{Mono|BaseXRepo}} or {{Mono|repo}}, which resides in your [[Configuration#Home Directory|home directory]].
Here we give simple examples of their usage and the usage of a package after it is installed.
===Installation===
A package can be installed using the {{Mono|REPO INSTALL}} command. The path to the package has to be given as a parameter. An example:
The installation will only succeed if the package fully conforms to the specification. If you know that your package is valid, you may as well unzip and copy its files directly to the repository, or edit its contents without reinstalling the package.
===Querying===
Installed packages can be addressed by importing them as ''modules''. Since we have the package repository in which all packages are located, it is sufficient to just specify the namespace of a module:
Package encapsulating Java archives can be imported in the same way as pure XQuery modules (see below).
===Listing===
All currently installed packages can be listed with the <code>REPO LIST</code> command. It will return the names of all packages, their version, and the directory in which they are installed:
1 package(s).
===Removal===
A package can be deleted with the command REPO DELETE and by specifying either its name or the name of its directory:
REPO DELETE http://www.functx.com ...or...
REPO DELETE functx-1.0
=Packaging=
==Simple Packaging==
On our [http://files.basex.org/modules/ file server], you can find some example libraries packaged as XML archives (xar files). You can use them to try our packaging API or just as a reference for creating your own packages.
==Changelog==
===Version 7.2.1===
* Added: simple packaging
[[Category:XQuery]]