Difference between revisions of "Maven"

From BaseX Documentation
Jump to navigation Jump to search
Line 3: Line 3:
 
==Using Maven==
 
==Using Maven==
 
   
 
   
If the standalone version of [http://maven.apache.org Maven] is installed,
+
If you have [[Git|cloned our repositories]] and installed Maven on your machine,
you can use the following commands in any of the BaseX repositories:
+
you can run the following commands from all local repository directories:
  
 
* <code>mvn compile</code>: the BaseX source files are compiled. To launch the project, type in <code>java -cp target/classes org.basex.BaseX</code>, or have a look at our [[Start Scripts]].
 
* <code>mvn compile</code>: the BaseX source files are compiled. To launch the project, type in <code>java -cp target/classes org.basex.BaseX</code>, or have a look at our [[Start Scripts]].
Line 11: Line 11:
 
   
 
   
 
By adding the flag <code>-DskipTests=true</code> you can skip running the JUnit tests and speed up the packaging procedure. You may as well use [[Integrate|Eclipse and m2eclipse]] to compile the BaseX sources.
 
By adding the flag <code>-DskipTests=true</code> you can skip running the JUnit tests and speed up the packaging procedure. You may as well use [[Integrate|Eclipse and m2eclipse]] to compile the BaseX sources.
+
 
 
==Artifacts==
 
==Artifacts==
  

Revision as of 02:04, 26 January 2012

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 repositories 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. To launch the project, type in java -cp target/classes org.basex.BaseX, or have a look at our Start Scripts.
  • mvn package: JAR archives are created in the target class directory.
  • 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=true you can skip running the JUnit tests and speed up the packaging procedure. You may as well use Eclipse and m2eclipse to compile the BaseX sources.

Artifacts

As BaseX is offered in a Maven repository, you can easily embed it into your own projects. To use the BaseX Maven Artifacts, add the following lines 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

<dependency>
  <groupId>org.basex</groupId>
  <artifactId>basex</artifactId>
  <version>6.7.1</version>
</dependency>

BaseX API

...including the REST, XML:DB and XQJ APIs:

<dependency>
  <groupId>org.basex</groupId>
  <artifactId>basex-api</artifactId>
  <version>6.7.1</version>
</dependency>