==Packaging==
With {{Version|7.2.1}}, XQuery modules and JAR archives can be directly installed to the repositoryby following just a few simple rules:
===XQuery===
If an XQuery file is specified as input for the install command, it will be copied to the repository if it can be successfully parsed as an XQuery module.The If parsing was successful, the module URI will be [[#URI Rewriting|rewritten]] to a file path, and the file will be to the last URI path segment and attached with the {{Mono|.xqm}} file suffix, and the original file will be copied to that path into the repository.
===Java===
The following steps are to Suitable JAR archives may contain one or more class files. One of them will be chosen as main class, which must be observed for packaging specified in a JAR archive{{Mono|Main-Class:}} entry in the manifest file ({{Mono|META-INF/MANIFEST.MF}}). This fully qualified Java class name will be rewritten to a file path by replacing the dots with slashes and attached with the {{Mono|.jar}} file suffix, and the original file will be copied to that path into the repository.
* The JAR archive must contain a manifest (public functions of this class can then be addressed from XQuery, using the class or file path as namespace URI, or an alternative writing that can be [[#URI Rewriting|rewritten]] to the module file path. '''Example:''' Contents of the file {{Mono|META-INF/MANIFEST.MFmf}}) with a in {{Mono|HelloWorld.jar}} Manifest-Version: 1.0 Main-Class:}} entry, which will be bound org.basex.modules.hello.World Destination path: org/basex/modules/hello/World.jar Possible paths to address the namespacemodule: * {{Mono|org.basex.modules.hello.World}}* All public functions of this class can then be addressed from XQuery.{{Mono|org/basex/modules/hello/World}}* The repository path to the JAR file can then be directly used as namespace URI{{Mono|http://basex.org/modules/hello/World}}
The article on [[Java Bindings]] gives more insight on how Java code is handled in XQuery.