Ticket #272 (closed task: fixed)
Opened 2010-11-08T12:22:37-06:00
Last modified 2010-11-29T13:16:57-06:00
JOCL as Maven Dependency
Reported by: | rlentz | Owned by: | rlentz |
---|---|---|---|
Priority: | minor | Milestone: |
|
Component: | Other | Version: | |
Severity: | serious | Keywords: | |
Cc: | Blocked By: | ||
Blocking: |
Description (last modified by rlentz)
Several libraries are used in ImageJ that rely on additional native libs. JOCL is an example of a software connector that allows use of OpenCL from within Java. This work will allow other native libs to become maven dependencies.
Attachments
Change History
comment:2 Changed 2010-11-09T15:36:06-06:00 by rlentz
- Status changed from new to accepted
A quick Google search revealed the following earlier work:
On 06/01/2010 02:36 PM, Kraft [via jogamp] wrote:
Hi !
Maybe this will help other user of jogl to use current JARs 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 :)
posted at:
http://jogamp.762907.n3.nabble.com/What-about-Maven-td844816.html
This is a great start... and with the additional platform jars at:
http://jogamp.org/deployment/jogamp-next/
Additionally, our repository information was added to the pom.xml
<repositories>
<!-- NB: for loci-base-pom -->
<repository>
<id>loci.releases</id>
<url> https://maven.scijava.org/content/repositories/releases</url>
</repository>
</repositories>
These maven dependencies will need to be added to the Java version.
comment:3 Changed 2010-11-09T16:44:03-06:00 by rlentz
add deps to https://maven.scijava.org/index.html#view-repositories;thirdparty
for nativewindow, jogl, jocl, and gluegen for win64,win32,osx,linux32,linux64
comment:4 Changed 2010-11-09T17:47:47-06:00 by rlentz
Several NAR application examples can be found at:
https://github.com/duns/maven-nar-plugin/tree/master/src/it
It turned out that the the maven-nar plugin was not needed for this example. Others can extend on the attached pom.xml file to ease use of JOGAMP gluegen-rt, jocl, jogl, and nativewindow dependencies.
comment:5 Changed 2010-11-11T15:42:34-06:00 by rlentz
comment:6 Changed 2010-11-29T13:16:57-06:00 by rlentz
- Status changed from accepted to closed
- Resolution set to fixed