This page is part of the [[Developer Section]]. It demonstrates how [https://maven.apache.org Maven] is used to compile and run BaseX, and embed it into other projects. ==Using Maven== If you have [[Git|cloned our repository]] and installed Maven on your machine,you can run the following commands from all local repository directories: * <pcode>As mvn compile</code>: the BaseX source files are compiled.* <code>mvn package</code>: JAR archives are created in the {{Code|target}} class directory, and all relevant libraries are created in the {{Code|lib}} directory. Packaging is offered in a Maven useful if you want to use the start scripts.* <code>mvn install</code>: the JAR archive is installed to the local repository, and made available to other Maven projects. This is particularly useful if you are compiling a beta version of BaseX, for which no archives exist in the repositories. By adding the flag <code>-DskipTests</code> you can easily embed skip the JUnit tests and speed up packaging. You may as well use [[IntegrateDeveloping with Eclipse|integrateEclipse and m2eclipse]] it into your own projectsto compile the BaseX sources.To use There are several alternatives for starting BaseX: * type in {{Code|java -cp target/classes org.basex.BaseX}} in the {{Code|basex-core}} directory to start BaseX on the command-line mode,* type in {{Code|mvn jetty:run}} in the {{Code|basex-api}} directory to start BaseX with Jetty and the HTTP servers,* run one of the [[Start Scripts]] contained in the {{Code|etc}} directory ==Artifacts== You can easily embed BaseX into your own Maven Artifacts, add projects by adding the following lines XML snippets to your<code>{{Code|pom.xml</code> }} file:</p> <pre classsyntaxhighlight lang="brush:xml"><<repositories>> <<repository>> <<id>dbis-ukn<>basex</id>> <<name>DBIS >BaseX Maven Repository<</name>> <<url>>http://wwwfiles.inf.uni-konstanzbasex.de/dbis/basexorg/maven<</url>> <</repository>><</repositories>></presyntaxhighlight>
===BaseX ArtifactMain Package=== <pre classsyntaxhighlight lang="brush:xml"><<dependency>> <<groupId>>org.basex<</groupId>> <<artifactId>>basex<</artifactId>> <<version>>7.6</version></dependency></syntaxhighlight> ===APIs and Services=== <p>.3.4<.including APIs and the [[REST]], [[RESTXQ]] and [[WebDAV]] services:</p> <syntaxhighlight lang="xml"><dependency> <groupId>org.basex</groupId> <artifactId>basex-api</artifactId> <version>7.6</version>><</dependency>></presyntaxhighlight>
===BaseX XQJ API Artifact=== <p>...including the [[JAX-RX]], [http://sourceforge.net/projects/xmldb-org XML:DB][http://jcp.org/en/jsr/detail?id=225 XQJ] and API:</p> <pre class="brush:xml"><dependency> <groupId>org.basex</groupId> <artifactId>basex-api</artifactId> <version>6.3.4</version></dependency></pre>[[Category:Developer]]
[[Category<p>The XQJ API is hosted at http:Finish]]//xqj.net:</p> <syntaxhighlight lang="xml"><repository> <id>xqj</id> <name>XQJ Maven Repository</name> <url>http://xqj.net/maven</url></repository>...<dependency> <groupId>net.xqj</groupId> <artifactId>basex-xqj</artifactId> <version>1.2.0</version></dependency><dependency> <groupId>com.xqj2</groupId> <artifactId>xqj2</artifactId> <version>0.1.0</version></dependency><dependency> <groupId>javax.xml.xquery</groupId> <artifactId>xqj-api</artifactId> <version>1.0</version></dependency></syntaxhighlight>