Difference between revisions of "Maven"
Jump to navigation
Jump to search
m (Updating Maven details for BaseX XQJ 1.2 which uses XQJ2 0.1.0) |
|||
(14 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
==Using Maven== | ==Using Maven== | ||
− | If you have [[Git|cloned our | + | If you have [[Git|cloned our repository]] and installed Maven on your machine, |
you can run the following commands from all local repository directories: | you can run the following commands from all local repository directories: | ||
− | * <code>mvn compile</code>: the BaseX source files are compiled | + | * <code>mvn compile</code>: the BaseX source files are compiled. |
− | * <code>mvn package</code>: JAR archives are created in the | + | * <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 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 | + | * <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 | + | By adding the flag <code>-DskipTests</code> you can skip the JUnit tests and speed up packaging. You may as well use [[Developing with Eclipse|Eclipse and m2eclipse]] to compile the BaseX sources. |
+ | |||
+ | 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== | ==Artifacts== | ||
Line 28: | Line 34: | ||
<groupId>org.basex</groupId> | <groupId>org.basex</groupId> | ||
<artifactId>basex</artifactId> | <artifactId>basex</artifactId> | ||
− | <version>7. | + | <version>7.6</version> |
</dependency></pre> | </dependency></pre> | ||
Line 36: | Line 42: | ||
<groupId>org.basex</groupId> | <groupId>org.basex</groupId> | ||
<artifactId>basex-api</artifactId> | <artifactId>basex-api</artifactId> | ||
− | <version>7. | + | <version>7.6</version> |
</dependency></pre> | </dependency></pre> | ||
Line 64: | Line 70: | ||
</dependency> | </dependency> | ||
</pre> | </pre> | ||
− | |||
− | |||
− |
Revision as of 15:56, 17 January 2016
This page is part of the Developer Section. It demonstrates how Maven is used to compile and run BaseX, and embed it into other projects.
Using Maven
If you have cloned our repository and installed Maven on your machine, you can run the following commands from all local repository directories:
mvn compile
: the BaseX source files are compiled.mvn package
: JAR archives are created in thetarget
class directory, and all relevant libraries are created in thelib
directory. Packaging is useful if you want to use the start scripts.mvn install
: 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 -DskipTests
you can skip the JUnit tests and speed up packaging. You may as well use Eclipse and m2eclipse to compile the BaseX sources.
There are several alternatives for starting BaseX:
- type in
java -cp target/classes org.basex.BaseX
in thebasex-core
directory to start BaseX on the command-line mode, - type in
mvn jetty:run
in thebasex-api
directory to start BaseX with Jetty and the HTTP servers, - run one of the Start Scripts contained in the
etc
directory
Artifacts
You can easily embed BaseX into your own Maven projects by adding the following XML snippets to your pom.xml
file:
<repositories> <repository> <id>basex</id> <name>BaseX Maven Repository</name> <url>http://files.basex.org/maven</url> </repository> </repositories>
BaseX Main Package
<dependency> <groupId>org.basex</groupId> <artifactId>basex</artifactId> <version>7.6</version> </dependency>
APIs and Services
...including APIs and the REST, RESTXQ and WebDAV services:
<dependency> <groupId>org.basex</groupId> <artifactId>basex-api</artifactId> <version>7.6</version> </dependency>
XQJ API
The XQJ API is hosted at http://xqj.net:
<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>