Maven

JogAmp now contains support for Maven. From 2.0-rc11 to 2.3.2, packages are pushed to |ga|1|jogamp Maven Central. Since 2.4.0, they are pushed only to the Jogamp Test Repository.

= Add dependencies on the correct packages =

If you don't know which packages you want, you almost certainly want to use the jogl-all-main and gluegen-rt-main packages, as these automatically set up the correct dependencies on the native jar files for all platforms.

N.B: Please note that the version 2.3.2 was released in 2015, is obsolete, is the last version available in Maven Central and is only mentioned as an example but the later versions are only available in the JogAmp test repository (not in Maven Central).

As an example, if your project uses JOGL 2.3.2:

org.jogamp.gluegen gluegen-rt-main 2.3.2      org.jogamp.jogl</groupId> jogl-all-main</artifactId> 2.3.2

Maven will pull all of the dependencies the next time you attempt to build the project.

Additionally, for joal</tt> and jocl</tt> support:

org.jogamp.jocl</groupId> jocl-main</artifactId> 2.3.2      org.jogamp.joal</groupId> joal-main</artifactId> 2.3.2

An example project is available in the maven</tt> subdirectory of the jogl-demos</tt> project .

= Package details =

For each JogAmp project, there are essentially two packages published: One contains the main compiled jar files and any associated native library jar files, and the other simply contains dependencies on those files. Using jogl-all</tt> and jogl-all-main</tt> as the example, the jogl-all</tt> package in the jogamp.org test repository:

https://jogamp.org/deployment/maven/org/jogamp/jogl/jogl-all/2.3.2/

Note that there are many native jar files attached to the main package. However, if you were to use the following dependency in your own project:

org.jogamp.jogl</groupId> jogl-all</artifactId> 2.3.2

Maven would download jogl-all-2.3.2.jar</tt> but would completely ignore all of the other native jar files. Why? The reason for this is that the native jar files are uploaded as extra artifacts to the <tt>jogl-all</tt> package and are, in a manner of speaking, not really considered to be part of the package where dependencies are concerned. The POM for the <tt>jogl-all-main</tt> package adds explicit dependencies on all of the extra artifacts in the <tt>jogl-all</tt> package:

https://jogamp.org/deployment/maven/org/jogamp/jogl/jogl-all-main/2.3.2/jogl-all-main-2.3.2.pom

So, when you add a dependency on <tt>jogl-all-main</tt> in your own project, the native jar files of <tt>jogl-all</tt> are brought in as transitive dependencies and everything works as expected.

= Available packages =

= Atomic jar files (optional) =

The so-called atomic jar files are provided as attachments to the <tt>jogl</tt>, <tt>newt</tt>, <tt>nativewindow</tt> and <tt>gluegen</tt> packages. As an example, to depend only on the Linux AMD64 native jar files, on X11, using only the core of <tt>jogl</tt> and the native window toolkit in your own projects, use the following dependencies:

<groupId>org.jogamp.gluegen-rt</groupId> <artifactId>jogl</artifactId> 2.3.2    <groupId>org.jogamp.gluegen-rt</groupId> <artifactId>jogl</artifactId> 2.3.2    natives-linux-amd64 <groupId>org.jogamp.jogl</groupId> <artifactId>jogl</artifactId> 2.3.2    core <groupId>org.jogamp.jogl</groupId> <artifactId>jogl</artifactId> 2.3.2    natives-linux-amd64 <groupId>org.jogamp.jogl</groupId> <artifactId>jogl</artifactId> 2.3.2    os-x11 <groupId>org.jogamp.jogl</groupId> <artifactId>jogl</artifactId> 2.3.2    os-x11 <groupId>org.jogamp.jogl</groupId> <artifactId>newt</artifactId> 2.3.2    driver-x11 <groupId>org.jogamp.jogl</groupId> <artifactId>newt</artifactId> 2.3.2    core <groupId>org.jogamp.jogl</groupId> <artifactId>newt</artifactId> 2.3.2    natives-linux-amd64 <groupId>org.jogamp.jogl</groupId> <artifactId>nativewindow</artifactId> 2.3.2    core <groupId>org.jogamp.jogl</groupId> <artifactId>nativewindow</artifactId> 2.3.2    natives-linux-amd64 <groupId>org.jogamp.jogl</groupId> <artifactId>nativewindow</artifactId> 2.3.2    driver-x11

Note that the choice of which atomic jars are required is really outside of the scope of this documentation. It's recommended that you browse the packages in question to see which jar files are available. It's not recommended to depend on platform-specific jar files in the manner shown above unless there's an extremely good reason to do so; to do otherwise harms portability for no good reason!

= The jogamp.org test repository =

Bleeding edge, experimental packages will continue to be made available from the Jogamp Test Repository. Most users won't need this, but it can be used by adding a new profile in your <tt>~/.m2/settings.xml</tt> file that specifies the repository:

<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <id>jogamp</id> <id>jogamp-remote</id> jogamp test mirror https://www.jogamp.org/deployment/maven/ default <activeProfiles> <activeProfile>jogamp</activeProfile> </activeProfiles>

This repository can be added into the POM file like in this very simple example.

Maven will then check this repository for packages in addition to Maven Central when resolving dependencies.

'Please note that some packages on the Jogamp test repository are subject to unannounced changes at any moment and may break existing code at any time! Do not use for production code!'

Since <tt>2.4.0</tt>, the releases and the release candidates are pushed only to this repository.

= Android =

There is a separate page documenting one method of producing packages that work on both Android and ordinary desktop Java.

= Producing a fat jar =

See JAR File Handling.