Maven: Difference between revisions
→Android: spelling mistake "seperate" -> "separate" |
No edit summary |
||
(12 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
__TOC__ | __TOC__ | ||
JogAmp now contains support for Maven. | JogAmp now contains support for Maven via its [https://jogamp.org/deployment/maven/ the Jogamp Mirror Repository]. | ||
[http://search.maven.org/#search|ga|1|jogamp Maven Central]. | |||
From <tt>2.0-rc11</tt> to <tt>2.3.2</tt> and from <tt>2.6.0</tt>, packages are pushed to | |||
[http://search.maven.org/#search|ga|1|jogamp Maven Central]. | |||
= Add dependencies on the correct packages = | = Add dependencies on the correct packages = | ||
Line 10: | Line 12: | ||
set up the correct dependencies on the native jar files for all platforms. | set up the correct dependencies on the native jar files for all platforms. | ||
As an example, if your project uses JOGL <tt>2.0 | As an example, if your project uses JOGL <tt>2.6.0</tt>: | ||
< | <pre> | ||
<dependencies> | <dependencies> | ||
<dependency> | <dependency> | ||
<groupId>org.jogamp.gluegen</groupId> | <groupId>org.jogamp.gluegen</groupId> | ||
<artifactId>gluegen-rt-main</artifactId> | <artifactId>gluegen-rt-main</artifactId> | ||
<version>2.0 | <version>2.6.0</version> | ||
</dependency> | </dependency> | ||
<dependency> | <dependency> | ||
<groupId>org.jogamp.jogl</groupId> | <groupId>org.jogamp.jogl</groupId> | ||
<artifactId>jogl-all-main</artifactId> | <artifactId>jogl-all-main</artifactId> | ||
<version>2.0 | <version>2.6.0</version> | ||
</dependency> | </dependency> | ||
</dependencies> | </dependencies> | ||
</ | </pre> | ||
Maven will pull all of the dependencies the next time you attempt to build the project. | Maven will pull all of the dependencies the next time you attempt to build the project. | ||
Line 31: | Line 33: | ||
Additionally, for <tt>joal</tt> and <tt>jocl</tt> support: | Additionally, for <tt>joal</tt> and <tt>jocl</tt> support: | ||
< | <pre> | ||
<dependencies> | <dependencies> | ||
<dependency> | <dependency> | ||
<groupId>org.jogamp.jocl</groupId> | <groupId>org.jogamp.jocl</groupId> | ||
<artifactId>jocl-main</artifactId> | <artifactId>jocl-main</artifactId> | ||
<version>2.0 | <version>2.6.0</version> | ||
</dependency> | </dependency> | ||
<dependency> | <dependency> | ||
<groupId>org.jogamp.joal</groupId> | <groupId>org.jogamp.joal</groupId> | ||
<artifactId>joal-main</artifactId> | <artifactId>joal-main</artifactId> | ||
<version>2.0 | <version>2.6.0</version> | ||
</dependency> | </dependency> | ||
</dependencies> | </dependencies> | ||
</ | </pre> | ||
An example project is available in the <tt>maven</tt> subdirectory of the <tt>jogl-demos</tt> project | An example project is available in the <tt>maven</tt> subdirectory of the <tt>jogl-demos</tt> project | ||
[ | [https://jogamp.org/git/?p=jogl-demos.git;a=tree;f=maven]. | ||
= Package details = | = Package details = | ||
Line 54: | Line 56: | ||
jar files and any associated native library jar files, and the other simply contains <i>dependencies</i> | jar files and any associated native library jar files, and the other simply contains <i>dependencies</i> | ||
on those files. Using <tt>jogl-all</tt> and <tt>jogl-all-main</tt> as the example, the <tt>jogl-all</tt> | on those files. Using <tt>jogl-all</tt> and <tt>jogl-all-main</tt> as the example, the <tt>jogl-all</tt> | ||
package in the jogamp.org | package in the jogamp.org mirror repository: | ||
https://jogamp.org/deployment/maven/org/jogamp/jogl/jogl-all/2.6.0/ | |||
Note that there are many native jar files attached to the main package. However, if you were to use | 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: | the following dependency in your own project: | ||
< | <pre> | ||
<dependency> | <dependency> | ||
<groupId>org.jogamp.jogl</groupId> | <groupId>org.jogamp.jogl</groupId> | ||
<artifactId>jogl-all</artifactId> | <artifactId>jogl-all</artifactId> | ||
<version>2.0 | <version>2.6.0</version> | ||
</dependency> | </dependency> | ||
</ | </pre> | ||
Maven would download <tt>jogl-all-2.0 | Maven would download <tt>jogl-all-2.6.0.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 | 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 | to the <tt>jogl-all</tt> package and are, in a manner of speaking, not really considered to be part of | ||
Line 75: | Line 77: | ||
explicit dependencies on all of the extra artifacts in the <tt>jogl-all</tt> package: | 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.6.0/jogl-all-main-2.6.0.pom | |||
So, when you add a dependency on <tt>jogl-all-main</tt> in your own project, the native jar files of | So, when you add a dependency on <tt>jogl-all-main</tt> in your own project, the native jar files of | ||
Line 217: | Line 219: | ||
own projects, use the following dependencies: | own projects, use the following dependencies: | ||
< | <pre> | ||
<dependency> | <dependency> | ||
<groupId>org.jogamp.gluegen-rt</groupId> | <groupId>org.jogamp.gluegen-rt</groupId> | ||
<artifactId>jogl</artifactId> | <artifactId>jogl</artifactId> | ||
<version>2.0 | <version>2.6.0</version> | ||
</dependency> | </dependency> | ||
<dependency> | <dependency> | ||
<groupId>org.jogamp.gluegen-rt</groupId> | <groupId>org.jogamp.gluegen-rt</groupId> | ||
<artifactId>jogl</artifactId> | <artifactId>jogl</artifactId> | ||
<version>2.0 | <version>2.6.0</version> | ||
<classifier>natives-linux-amd64</classifier> | <classifier>natives-linux-amd64</classifier> | ||
</dependency> | </dependency> | ||
Line 232: | Line 234: | ||
<groupId>org.jogamp.jogl</groupId> | <groupId>org.jogamp.jogl</groupId> | ||
<artifactId>jogl</artifactId> | <artifactId>jogl</artifactId> | ||
<version>2.0 | <version>2.6.0</version> | ||
<classifier>core</classifier> | <classifier>core</classifier> | ||
</dependency> | </dependency> | ||
Line 238: | Line 240: | ||
<groupId>org.jogamp.jogl</groupId> | <groupId>org.jogamp.jogl</groupId> | ||
<artifactId>jogl</artifactId> | <artifactId>jogl</artifactId> | ||
<version>2.0 | <version>2.6.0</version> | ||
<classifier>natives-linux-amd64</classifier> | <classifier>natives-linux-amd64</classifier> | ||
</dependency> | </dependency> | ||
Line 244: | Line 246: | ||
<groupId>org.jogamp.jogl</groupId> | <groupId>org.jogamp.jogl</groupId> | ||
<artifactId>jogl</artifactId> | <artifactId>jogl</artifactId> | ||
<version>2.0 | <version>2.6.0</version> | ||
<classifier>os-x11</classifier> | <classifier>os-x11</classifier> | ||
</dependency> | </dependency> | ||
Line 250: | Line 252: | ||
<groupId>org.jogamp.jogl</groupId> | <groupId>org.jogamp.jogl</groupId> | ||
<artifactId>jogl</artifactId> | <artifactId>jogl</artifactId> | ||
<version>2.0 | <version>2.6.0</version> | ||
<classifier>os-x11</classifier> | <classifier>os-x11</classifier> | ||
</dependency> | </dependency> | ||
Line 256: | Line 258: | ||
<groupId>org.jogamp.jogl</groupId> | <groupId>org.jogamp.jogl</groupId> | ||
<artifactId>newt</artifactId> | <artifactId>newt</artifactId> | ||
<version>2.0 | <version>2.6.0</version> | ||
<classifier>driver-x11</classifier> | <classifier>driver-x11</classifier> | ||
</dependency> | </dependency> | ||
Line 262: | Line 264: | ||
<groupId>org.jogamp.jogl</groupId> | <groupId>org.jogamp.jogl</groupId> | ||
<artifactId>newt</artifactId> | <artifactId>newt</artifactId> | ||
<version>2.0 | <version>2.6.0</version> | ||
<classifier>core</classifier> | <classifier>core</classifier> | ||
</dependency> | </dependency> | ||
Line 268: | Line 270: | ||
<groupId>org.jogamp.jogl</groupId> | <groupId>org.jogamp.jogl</groupId> | ||
<artifactId>newt</artifactId> | <artifactId>newt</artifactId> | ||
<version>2.0 | <version>2.6.0</version> | ||
<classifier>natives-linux-amd64</classifier> | <classifier>natives-linux-amd64</classifier> | ||
</dependency> | </dependency> | ||
Line 274: | Line 276: | ||
<groupId>org.jogamp.jogl</groupId> | <groupId>org.jogamp.jogl</groupId> | ||
<artifactId>nativewindow</artifactId> | <artifactId>nativewindow</artifactId> | ||
<version>2.0 | <version>2.6.0</version> | ||
<classifier>core</classifier> | <classifier>core</classifier> | ||
</dependency> | </dependency> | ||
Line 280: | Line 282: | ||
<groupId>org.jogamp.jogl</groupId> | <groupId>org.jogamp.jogl</groupId> | ||
<artifactId>nativewindow</artifactId> | <artifactId>nativewindow</artifactId> | ||
<version>2.0 | <version>2.6.0</version> | ||
<classifier>natives-linux-amd64</classifier> | <classifier>natives-linux-amd64</classifier> | ||
</dependency> | </dependency> | ||
Line 286: | Line 288: | ||
<groupId>org.jogamp.jogl</groupId> | <groupId>org.jogamp.jogl</groupId> | ||
<artifactId>nativewindow</artifactId> | <artifactId>nativewindow</artifactId> | ||
<version>2.0 | <version>2.6.0</version> | ||
<classifier>driver-x11</classifier> | <classifier>driver-x11</classifier> | ||
</dependency> | </dependency> | ||
</ | </pre> | ||
Note that the choice of which atomic jars are required is really outside of the scope of this | Note that the choice of which atomic jars are required is really outside of the scope of this | ||
Line 297: | Line 299: | ||
harms portability for no good reason! | harms portability for no good reason! | ||
= The jogamp.org | = The jogamp.org Mirror Repository = | ||
Bleeding edge, experimental packages will continue to be made available from the | Bleeding edge, experimental packages will continue to be made available from the | ||
[ | [https://jogamp.org/deployment/maven Jogamp Mirror Repository] and can be used | ||
by adding a new profile in your <tt>~/.m2/settings.xml</tt> file that specifies this repository: | |||
< | <pre> | ||
<?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||
<settings | <settings | ||
Line 316: | Line 317: | ||
<repository> | <repository> | ||
<id>jogamp-remote</id> | <id>jogamp-remote</id> | ||
<name>jogamp | <name>jogamp mirror</name> | ||
<url> | <url>https://www.jogamp.org/deployment/maven/</url> | ||
<layout>default</layout> | <layout>default</layout> | ||
</repository> | </repository> | ||
Line 327: | Line 328: | ||
</activeProfiles> | </activeProfiles> | ||
</settings> | </settings> | ||
</ | </pre> | ||
This repository can be added into the POM file like in this [https://jogamp.org/cgit/jogl-demos.git/tree/maven/trivial-test/pom.xml very simple example]. | |||
Maven will then check this repository for packages in addition to Maven Central when resolving dependencies. | Maven will then check this repository for packages in addition to Maven Central when resolving dependencies. | ||
= Android = | = Android = | ||
Line 337: | Line 338: | ||
There is a [[Maven_And_Android|separate page]] documenting one method of producing packages that work on both Android and ordinary | There is a [[Maven_And_Android|separate page]] documenting one method of producing packages that work on both Android and ordinary | ||
desktop Java. | desktop Java. | ||
= Producing a fat jar = | |||
See [[JogAmp_JAR_File_Handling#Maven_Assembly_Plugin|JAR File Handling]]. |
Latest revision as of 23:54, 7 September 2025
JogAmp now contains support for Maven via its the Jogamp Mirror Repository.
From 2.0-rc11 to 2.3.2 and from 2.6.0, packages are pushed to Maven Central.
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.
As an example, if your project uses JOGL 2.6.0:
<dependencies> <dependency> <groupId>org.jogamp.gluegen</groupId> <artifactId>gluegen-rt-main</artifactId> <version>2.6.0</version> </dependency> <dependency> <groupId>org.jogamp.jogl</groupId> <artifactId>jogl-all-main</artifactId> <version>2.6.0</version> </dependency> </dependencies>
Maven will pull all of the dependencies the next time you attempt to build the project.
Additionally, for joal and jocl support:
<dependencies> <dependency> <groupId>org.jogamp.jocl</groupId> <artifactId>jocl-main</artifactId> <version>2.6.0</version> </dependency> <dependency> <groupId>org.jogamp.joal</groupId> <artifactId>joal-main</artifactId> <version>2.6.0</version> </dependency> </dependencies>
An example project is available in the maven subdirectory of the jogl-demos project [1].
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 and jogl-all-main as the example, the jogl-all package in the jogamp.org mirror repository:
https://jogamp.org/deployment/maven/org/jogamp/jogl/jogl-all/2.6.0/
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:
<dependency> <groupId>org.jogamp.jogl</groupId> <artifactId>jogl-all</artifactId> <version>2.6.0</version> </dependency>
Maven would download jogl-all-2.6.0.jar 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 jogl-all 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 jogl-all-main package adds explicit dependencies on all of the extra artifacts in the jogl-all package:
https://jogamp.org/deployment/maven/org/jogamp/jogl/jogl-all-main/2.6.0/jogl-all-main-2.6.0.pom
So, when you add a dependency on jogl-all-main in your own project, the native jar files of jogl-all are brought in as transitive dependencies and everything works as expected.
Available packages
Group ID | Artifact ID | Since | Description |
org.jogamp.gluegen | gluegen-rt-android | 2.0.2-rc12 | GlueGen runtime code and native libraries (Android) |
org.jogamp.gluegen | gluegen-rt-main | 2.0-rc11 | Meta-package for automatic dependency resolution for the GlueGen runtime |
org.jogamp.gluegen | gluegen-rt | 2.0-rc11 | GlueGen runtime code and native libraries |
org.jogamp.gluegen | gluegen | 2.0-rc11 | GlueGen non-runtime code and native libraries (and atomic jars) |
org.jogamp.joal | joal-main | 2.0-rc11 | Meta-package for automatic dependency resolution for JOAL |
org.jogamp.joal | joal | 2.0-rc11 | JOAL code and native libraries |
org.jogamp.joal | joal-android | 2.2.0 | JOAL Android runtime |
org.jogamp.jocl | jocl-main | 2.0-rc11 | Meta-package for automatic dependency resolution for JOCL |
org.jogamp.jocl | jocl-android | 2.2.0 | JOCL Android runtime |
org.jogamp.jocl | jocl | 2.0-rc11 | JOCL code and native libraries |
org.jogamp.jogl | jogl-all-main | 2.0-rc11 | Meta-package for automatic dependency resolution for JOGL |
org.jogamp.jogl | jogl-all | 2.0-rc11 | JOGL code and native libraries |
org.jogamp.jogl | jogl-android | 2.0.2-rc12 | JOGL code and native libraries (Android) |
org.jogamp.jogl | jogl-android-main | 2.2.0 | Meta-package for automatic dependency resolution for JOGL (Android) |
org.jogamp.jogl | jogl-mobile-main | 2.0-rc11 | Meta-package for automatic dependency resolution for JOGL (mobile) |
org.jogamp.jogl | jogl-mobile | 2.0-rc11 | JOGL mobile code and native libraries (without AWT) |
org.jogamp.jogl | jogl-noawt-main | 2.0-rc11 | Meta-package for automatic dependency resolution for JOGL (without AWT) |
org.jogamp.jogl | jogl-noawt | 2.0-rc11 | JOGL code and native libraries (without AWT) |
org.jogamp.jogl | jogl | 2.0.2 | JOGL atomic jar files |
org.jogamp.jogl | nativewindow | 2.0.2 | Native window drivers for NEWT (atomic jars) |
org.jogamp.jogl | nativewindow-main | 2.2.0 | Native window drivers for NEWT (atomic frontend) |
org.jogamp.jogl | newt | 2.0.2 | NEWT code and native libraries (atomic jars) |
org.jogamp.jogl | newt-main | 2.2.0 | NEWT code and native libraries (atomic frontend) |
org.jogamp.jogl | occulusvr | 2.2.0 | JOGL code and native libraries (Oculus VR atomic jar files) |
Atomic jar files (optional)
The so-called atomic jar files are provided as attachments to the jogl, newt, nativewindow and gluegen packages. As an example, to depend only on the Linux AMD64 native jar files, on X11, using only the core of jogl and the native window toolkit in your own projects, use the following dependencies:
<dependency> <groupId>org.jogamp.gluegen-rt</groupId> <artifactId>jogl</artifactId> <version>2.6.0</version> </dependency> <dependency> <groupId>org.jogamp.gluegen-rt</groupId> <artifactId>jogl</artifactId> <version>2.6.0</version> <classifier>natives-linux-amd64</classifier> </dependency> <dependency> <groupId>org.jogamp.jogl</groupId> <artifactId>jogl</artifactId> <version>2.6.0</version> <classifier>core</classifier> </dependency> <dependency> <groupId>org.jogamp.jogl</groupId> <artifactId>jogl</artifactId> <version>2.6.0</version> <classifier>natives-linux-amd64</classifier> </dependency> <dependency> <groupId>org.jogamp.jogl</groupId> <artifactId>jogl</artifactId> <version>2.6.0</version> <classifier>os-x11</classifier> </dependency> <dependency> <groupId>org.jogamp.jogl</groupId> <artifactId>jogl</artifactId> <version>2.6.0</version> <classifier>os-x11</classifier> </dependency> <dependency> <groupId>org.jogamp.jogl</groupId> <artifactId>newt</artifactId> <version>2.6.0</version> <classifier>driver-x11</classifier> </dependency> <dependency> <groupId>org.jogamp.jogl</groupId> <artifactId>newt</artifactId> <version>2.6.0</version> <classifier>core</classifier> </dependency> <dependency> <groupId>org.jogamp.jogl</groupId> <artifactId>newt</artifactId> <version>2.6.0</version> <classifier>natives-linux-amd64</classifier> </dependency> <dependency> <groupId>org.jogamp.jogl</groupId> <artifactId>nativewindow</artifactId> <version>2.6.0</version> <classifier>core</classifier> </dependency> <dependency> <groupId>org.jogamp.jogl</groupId> <artifactId>nativewindow</artifactId> <version>2.6.0</version> <classifier>natives-linux-amd64</classifier> </dependency> <dependency> <groupId>org.jogamp.jogl</groupId> <artifactId>nativewindow</artifactId> <version>2.6.0</version> <classifier>driver-x11</classifier> </dependency>
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 Mirror Repository
Bleeding edge, experimental packages will continue to be made available from the Jogamp Mirror Repository and can be used by adding a new profile in your ~/.m2/settings.xml file that specifies this 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"> <profiles> <profile> <id>jogamp</id> <repositories> <repository> <id>jogamp-remote</id> <name>jogamp mirror</name> <url>https://www.jogamp.org/deployment/maven/</url> <layout>default</layout> </repository> </repositories> </profile> </profiles> <activeProfiles> <activeProfile>jogamp</activeProfile> </activeProfiles> </settings>
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.
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.