Posted by
Kraft on
Jun 01, 2010; 12:36pm
URL: https://forum.jogamp.org/What-about-Maven-tp844816p861275.html
Hi !
Maybe this will help other user of jogl to use JARs of the current build into their maven projects.
After some days trying many solutions, here is what i found :
My goal :My goal was to make use of
- gluegen-rt.jar
- gluegen-rt-natives-linux-i586.jar
- jogl.all.jar
- jogl.all-natives-linux-i586.jar
- nativewindow.all.jar
- nativewindow-natives-linux-i586.jar
in
Ubuntu+
Eclipse+
Maven+
Nexus.
I wanted to configure all stuff about dependencies to jogl into the pom.xml of my project.
Then other members of my dev team just have to checkout the project (including the pom.xml) from the svn repository to have a complete configured project.
My solution :* in Nexus, i uploaded the artifact listed above in the 3rd party repository.
I set the groupid to "jogamp" and the articatid to the name of the jar (without .jar)
* In Eclipse, in the pom.xml of the project,
i declared the repository like this (you can utilize my nexus repository if you want but at your own risks ^^)
<repository>
<id>blackpad-nexus</id>
<name>Blackpad Nexus</name>
<layout>default</layout>
<url>http://www.blackpad.fr/nexus/content/groups/public</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
I declared the dependencies to jogl like this :
<dependency>
<groupId>jogamp</groupId>
<artifactId>gluegen-rt</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>jogamp</groupId>
<artifactId>gluegen-rt-natives-linux-i586</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>jogamp</groupId>
<artifactId>nativewindow.all</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>jogamp</groupId>
<artifactId>nativewindow-natives-linux-i586</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>jogamp</groupId>
<artifactId>jogl.all</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>jogamp</groupId>
<artifactId>jogl-natives-linux-i586</artifactId>
<version>0.0.1</version>
</dependency>
Then 2 steps to make maven add the .so (for linux but you can adapt to windows or macos) into the java.library.path.
- First, i configured the maven-dependency-plugin to unpack the natives jars into /target/lib after downloading them
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>compile</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>jogamp</groupId>
<artifactId>gluegen-rt-natives-linux-i586</artifactId>
<version>0.0.1</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>jogamp</groupId>
<artifactId>jogl-natives-linux-i586</artifactId>
<version>0.0.1</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>jogamp</groupId>
<artifactId>nativewindow-natives-linux-i586</artifactId>
<version>0.0.1</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
- Second, to let java found the natives libs, when i run the project using the "Run As" menu, i made a new Run Configuration and added -Djava.library.path=/target/lib as argument.
That's it !
With some adjustments , this solution let you use jogl in a maven project on any platform.
Hope i'm understandable, anyway i'm open to questions :)