blob: 9c628def99c70c6670148ff34b2d993e7a202f24 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<title>Apache Jena - Using Jena with Apache Maven</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="/css/bootstrap-extension.css" rel="stylesheet" type="text/css">
<link href="/css/jena.css" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="/images/favicon.ico" />
<script src="https://code.jquery.com/jquery-2.2.4.min.js"
integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
crossorigin="anonymous"></script>
<script src="/js/jena-navigation.js" type="text/javascript"></script>
<script src="/js/bootstrap.min.js" type="text/javascript"></script>
<script src="/js/improve.js" type="text/javascript"></script>
</head>
<body>
<nav class="navbar navbar-default" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/index.html">
<img class="logo-menu" src="/images/jena-logo/jena-logo-notext-small.png" alt="jena logo">Apache Jena</a>
</div>
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<li id="homepage"><a href="/index.html"><span class="glyphicon glyphicon-home"></span> Home</a></li>
<li id="download"><a href="/download/index.cgi"><span class="glyphicon glyphicon-download-alt"></span> Download</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-book"></span> Learn <b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="dropdown-header">Tutorials</li>
<li><a href="/tutorials/index.html">Overview</a></li>
<li><a href="/documentation/fuseki2/index.html">Fuseki Triplestore</a></li>
<li><a href="/documentation/notes/index.html">How-To's</a></li>
<li><a href="/documentation/query/manipulating_sparql_using_arq.html">Manipulating SPARQL using ARQ</a></li>
<li><a href="/tutorials/rdf_api.html">RDF core API tutorial</a></li>
<li><a href="/tutorials/sparql.html">SPARQL tutorial</a></li>
<li><a href="/tutorials/using_jena_with_eclipse.html">Using Jena with Eclipse</a></li>
<li class="divider"></li>
<li class="dropdown-header">References</li>
<li><a href="/documentation/index.html">Overview</a></li>
<li><a href="/documentation/query/index.html">ARQ (SPARQL)</a></li>
<li><a href="/documentation/assembler/index.html">Assembler</a></li>
<li><a href="/documentation/tools/index.html">Command-line tools</a></li>
<li><a href="/documentation/rdfs/">Data with RDFS Inferencing</a></li>
<li><a href="/documentation/geosparql/index.html">GeoSPARQL</a></li>
<li><a href="/documentation/inference/index.html">Inference API</a></li>
<li><a href="/documentation/javadoc.html">Javadoc</a></li>
<li><a href="/documentation/ontology/">Ontology API</a></li>
<li><a href="/documentation/permissions/index.html">Permissions</a></li>
<li><a href="/documentation/extras/querybuilder/index.html">Query Builder</a></li>
<li><a href="/documentation/rdf/index.html">RDF API</a></li>
<li><a href="/documentation/rdfconnection/">RDF Connection - SPARQL API</a></li>
<li><a href="/documentation/io/">RDF I/O</a></li>
<li><a href="/documentation/rdfstar/index.html">RDF-star</a></li>
<li><a href="/documentation/shacl/index.html">SHACL</a></li>
<li><a href="/documentation/shex/index.html">ShEx</a></li>
<li><a href="/documentation/jdbc/index.html">SPARQL over JDBC</a></li>
<li><a href="/documentation/tdb/index.html">TDB</a></li>
<li><a href="/documentation/tdb2/index.html">TDB2</a></li>
<li><a href="/documentation/query/text-query.html">Text Search</a></li>
</ul>
</li>
<li class="drop down">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-book"></span> Javadoc <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="/documentation/javadoc.html">All Javadoc</a></li>
<li><a href="/documentation/javadoc/arq/">ARQ</a></li>
<li><a href="/documentation/javadoc_elephas.html">Elephas</a></li>
<li><a href="/documentation/javadoc/fuseki2/">Fuseki</a></li>
<li><a href="/documentation/javadoc/geosparql/">GeoSPARQL</a></li>
<li><a href="/documentation/javadoc/jdbc/">JDBC</a></li>
<li><a href="/documentation/javadoc/jena/">Jena Core</a></li>
<li><a href="/documentation/javadoc/permissions/">Permissions</a></li>
<li><a href="/documentation/javadoc/extras/querybuilder/">Query Builder</a></li>
<li><a href="/documentation/javadoc/shacl/">SHACL</a></li>
<li><a href="/documentation/javadoc/tdb/">TDB</a></li>
<li><a href="/documentation/javadoc/text/">Text Search</a></li>
</ul>
</li>
<li id="ask"><a href="/help_and_support/index.html"><span class="glyphicon glyphicon-question-sign"></span> Ask</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-bullhorn"></span> Get involved <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="/getting_involved/index.html">Contribute</a></li>
<li><a href="/help_and_support/bugs_and_suggestions.html">Report a bug</a></li>
<li class="divider"></li>
<li class="dropdown-header">Project</li>
<li><a href="/about_jena/about.html">About Jena</a></li>
<li><a href="/about_jena/architecture.html">Architecture</a></li>
<li><a href="/about_jena/citing.html">Citing</a></li>
<li><a href="/about_jena/team.html">Project team</a></li>
<li><a href="/about_jena/contributions.html">Related projects</a></li>
<li><a href="/about_jena/roadmap.html">Roadmap</a></li>
<li class="divider"></li>
<li class="dropdown-header">ASF</li>
<li><a href="http://www.apache.org/">Apache Software Foundation</a></li>
<li><a href="http://www.apache.org/foundation/sponsorship.html">Become a Sponsor</a></li>
<li><a href="http://www.apache.org/licenses/LICENSE-2.0">License</a></li>
<li><a href="http://www.apache.org/security/">Security</a></li>
<li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li>
</ul>
</li>
<li id="edit"><a href="https://github.com/apache/jena-site/edit/main/source/download/maven.md" title="Edit this page on GitHub"><span class="glyphicon glyphicon-pencil"></span> Edit this page</a></li>
</ul>
</div>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-md-12">
<div id="breadcrumbs">
<ol class="breadcrumb">
<li><a href='/download'>DOWNLOAD</a></li>
<li class="active">MAVEN</li>
</ol>
</div>
<h1 class="title">Using Jena with Apache Maven</h1>
<p><a href="http://maven.apache.org">Apache Maven</a> is a tool to help Java projects manage
their dependencies on library code, such as Jena. By declaring a dependency on
the core of Jena in your project&rsquo;s <code>pom.xml</code> file, you will get the
consistent set of library files that Jena depends on automatically added too.</p>
<p>This page assumes you have Maven installed on your computer. If this is not the case,
please read and follow <a href="http://maven.apache.org/download.html#Installation">these instructions</a>.</p>
<h3 id="repositories">Repositories</h3>
<p>Released maven artifacts are mirrored to the central maven repositories.</p>
<p>Development snapshots are available as well.<br>
<a href="https://repository.apache.org/content/repositories/snapshots/">https://repository.apache.org/content/repositories/snapshots/</a></p>
<p>Stable Jena releases are automatically mirrored by the central Maven
repositories, so there will normally be no need to add any extra
repositories to your <code>pom.xml</code> or <code>settings.xml</code>.</p>
<h3 id="specifying-jena-as-a-dependency">Specifying Jena as a dependency</h3>
<p>This is how to specify in your pom.xml file the dependency
on a version of Jena:</p>
<pre><code> &lt;dependency&gt;
&lt;groupId&gt;org.apache.jena&lt;/groupId&gt;
&lt;artifactId&gt;apache-jena-libs&lt;/artifactId&gt;
&lt;type&gt;pom&lt;/type&gt;
&lt;version&gt;X.Y.Z&lt;/version&gt;
&lt;/dependency&gt;
</code></pre>
<p>This will transitively resolve all the dependencies for you: <code>jena-core</code>,
<code>jena-arq</code>, <code>jena-tdb</code> and <code>jena-iri</code> and their dependencies.</p>
<p>Note the use of <code>&lt;type&gt;pom&lt;/type&gt;</code> above.</p>
<p>Other modules need to be added separately, for example:</p>
<pre><code> &lt;dependency&gt;
&lt;groupId&gt;org.apache.jena&lt;/groupId&gt;
&lt;artifactId&gt;jena-text&lt;/artifactId&gt;
&lt;version&gt;x.y.z&lt;/version&gt;
&lt;/dependency&gt;
</code></pre>
<p>Please check for the latest versions.</p>
<h3 id="major-artifacts">Major Artifacts</h3>
<p>Jena provides a number of maven artifacts as delivery points.<br>
There are also a number of maven artifacts used as part of
structuring Jena development.</p>
<table>
<tr>
<th>Artifact ID</th>
<th>Packaging (&lt;type&gt;)</th>
<th>Description</th>
</tr>
<tr>
<td><code>apache-jena-libs</code></td>
<td><code>pom</code></td>
<td>A POM artifact that may be referenced to pull in all the standard Jena Libraries (Core, ARQ, IRI, and TDB) with a single dependency.</td>
</tr>
<tr>
<td><code>apache-jena</code></td>
<td><code>pom</code></td>
<td>The binary distribution</td>
</tr>
<tr>
<td><code>apache-jena-fuseki</code></td>
<td><code>pom</code></td>
<td>Fuseki2 distribution</td>
</tr>
<tr>
<td><code>jena</code></td>
<td></td>
<td>The formal released source-released for each Jena release. This is not a maven-runnable set of binary files</td>
</tr>
<tr>
<td><code>jena-fuseki-main</code></td>
<td><code>war</code></td>
<td>Fuseki packaged for standalone and embedded use.<td>
</tr>
<tr>
<td><code>jena-text</code></td>
<td><code>jar</code></td>
<td>SPARQL Text Search. Included in Fuseki.</td>
</tr>
<tr>
<td><code>jena-shacl</code></td>
<td><code>jar</code></td>
<td>SHACL engine for Jena.</td>
</tr>
<tr>
<td><code>jena-shex</code></td>
<td><code>jar</code></td>
<td>ShEx engine for Jena.</td>
</tr>
<tr>
<td><code>jena-querybuilder</code></td>
<td><code>jar</code></td>
<td>A utility package to simplify the building of ARQ queries in code.
</td>
</tr>
<tr>
<td><code>jena-permissions</code></td>
<td><code>jar</code></td>
<td>Security wrapper around Jena RDF implementation.</td>
</tr>
<tr>
<td><code>jena-jdbc-driver-bundle</code></td>
<td><code>jar</code></td>
<td>A collection of JDBC drivers</td>
</tr>
</table>
<p>There are also a number of artifacts used in development.
The full list can be seen by browsing Maven</p>
<p><a href="https://repo1.maven.org/maven2/org/apache/jena/">Released Jena artifacts</a></p>
<p>(This includes historic artifacts which are no longer active.)</p>
<p>You can run <code>mvn dependency:tree</code> to print the dependency
tree.</p>
<h3 id="specifying-dependencies-on-snapshots">Specifying dependencies on SNAPSHOTs</h3>
<p>If you want to depend on Jena development snapshots and help with Jena
development, e.g. to get access to recent bug fixes for testing, you
should add the following to your <code>pom.xml</code>:</p>
<pre><code> &lt;repository&gt;
&lt;id&gt;apache-repo-snapshots&lt;/id&gt;
&lt;url&gt;https://repository.apache.org/content/repositories/snapshots/&lt;/url&gt;
&lt;releases&gt;
&lt;enabled&gt;false&lt;/enabled&gt;
&lt;/releases&gt;
&lt;snapshots&gt;
&lt;enabled&gt;true&lt;/enabled&gt;
&lt;/snapshots&gt;
&lt;/repository&gt;
</code></pre>
<h3 id="build-and-install-artifacts-in-your-local-maven-repository">Build and install artifacts in your local Maven repository</h3>
<p>If you want you can checkout the Jena sources, build the artifacts and
install them in your local Maven repository, then you simply checkout the source
tree and build with maven
<code>mvn install</code>. This assumes you have Maven and Git installed:</p>
<pre><code>git clone https://github.com/apache/jena/
cd jena
mvn clean install
</code></pre>
<p>Each of the modules can be built on its own but they
require the current snapshots and Jena parent POM to be installed.</p>
</div>
</div>
</div>
<footer class="footer">
<div class="container" style="font-size:80%" >
<p>
Copyright &copy; 2011&ndash;2022 The Apache Software Foundation, Licensed under the
<a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.
</p>
<p>
Apache Jena, Jena, the Apache Jena project logo, Apache and the Apache feather logos are trademarks of
The Apache Software Foundation.
<br/>
<a href="https://privacy.apache.org/policies/privacy-policy-public.html"
>Apache Software Foundation Privacy Policy</a>.
</p>
</div>
</footer>
<script type="text/javascript">
var link = $('a[href="' + this.location.pathname + '"]');
if (link != undefined)
link.parents('li,ul').addClass('active');
</script>
</body>
</html>