It describes how external XQuery packages can be installed in the system's repository
and used from XQuery, and how new packages can be built.
BaseX supports the [http://expath.org/modules/pkg/ EXPath Packaging API].
Since {{Version|7.2.1}}, we provide additional ways to further simplify
the deployment of XQuery modules and Java classes.
==Motivation==
BaseX offers two mechanisms to make new packages accessible to the XQuery processor:
* The [http://expath.org/modules/pkg/ [EXPath Packaging System] ] system provides a generic mechanism for extending XQuery processors with new packages.
A package is defined as a {{Mono|.xar}} archive, which encapsulates one or more extension libraries.
* Since {{MarkVersion|Since Version 7.2.1}}, we offer a [[Simple Packaging|simplified mechanism ]] to directly install XQuery archives and JAR files to the repository.
==Usage==
REPO DELETE functx-1.0
==XAR FilesEXPath Packaging==
The [http://expath.org/spec/pkg EXPath specification] defines how the structure of a .xar archive shall look like. The package contains at its root a package descriptor named <code>expath-pkg.xml</code>. This descriptor presents some meta data about the package as well as the libraries which it contains and their dependencies on other libraries or processors.
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.
==JAR FilesSimple Packaging==
{{Mark|Since Version 7.2.1}}, simple JAR archives can be treated and installed as XQuery modules. The article on [[Java Bindings]] gives more insight on how Java code is handled in XQuery. The following steps are to be observed when preparing a JAR archive: