Maven

From JogampWiki
Jump to navigation Jump to search

JogAmp now contains support for Maven. As of 2.0-rc11, 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.0.2-rc12:

 <dependencies>
   <dependency>
     <groupId>org.jogamp.gluegen</groupId>
     <artifactId>gluegen-rt-main</artifactId>
     <version>2.0.2-rc12</version>
   </dependency>
   <dependency>
     <groupId>org.jogamp.jogl</groupId>
     <artifactId>jogl-all-main</artifactId>
     <version>2.0.2-rc12</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.0.2-rc12</version>
   </dependency>
   <dependency>
     <groupId>org.jogamp.joal</groupId>
     <artifactId>joal-main</artifactId>
     <version>2.0.2-rc12</version>
   </dependency>
 </dependencies>

An example project is available in the maven subdirectory of the jogl-demos project [1].

The jogamp.org test repository (optional)

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 ~/.m2/settings.xml 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">
   <profiles>
     <profile>
       <id>jogamp</id>
       <repositories>
         <repository>
           <id>jogamp-remote</id>
           <name>jogamp test mirror</name>
           <url>http://www.jogamp.org/deployment/maven/</url>
           <layout>default</layout>
         </repository>
       </repositories>
     </profile>
   </profiles>
   <activeProfiles>
     <activeProfile>jogamp</activeProfile>
   </activeProfiles>
 </settings>

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

Please note that 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!