2

Quite time ago, there has been this post. I don't know exactly when Jogamp started to release native libraries as jar archives, but that new organisation make me feel that it can be easier to package os-specific jar, but I haven't got enough knowledge for this for now.

Jogamp has put a pom.xml in order to download all libraries, but all I've achieved is to regroup all jars in the final output jar.

I've seen it is possible to use several custom assemblies in a pom.xml : how could I define a single version of these assemblies as en example (I mean, for example, the one targetting linux-64) ?

Community
  • 1
  • 1
loloof64
  • 5,252
  • 12
  • 41
  • 78
  • Rather ask questions specific to JOGL on our official forum: http://forum.jogamp.org – gouessej Aug 23 '14 at 11:45
  • Thank you. Should I put I a link to this question on the official JOGL forum ? Maybe someone will give me a better solution this way. – loloof64 Aug 23 '14 at 15:17
  • Yes, you should. Mark, one of our contributors, answers to the questions about Maven. He could probably suggest you a better solution if any, otherwise we would add a link to your project into our wiki :) – gouessej Aug 24 '14 at 09:32
  • Ok. I will create a new topic on your forum, with a link to this question :) – loloof64 Aug 24 '14 at 09:42

1 Answers1

2

Finally I've managed to define several assemblies, and build the output with maven. I've created a small JOGL project using this method here

Here is the assembly for Linux64, for example (located at src/main/assembly folder) :

<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
  <id>linux-amd64</id>
  <formats>
    <format>jar</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <dependencySets>
    <dependencySet>
      <useProjectArtifact>false</useProjectArtifact>
      <unpack>false</unpack>
      <includes>
        <include>org.jogamp.jogl:jogl-all:jar:2.2.0</include>
        <include>org.jogamp.jogl:jogl-all:jar:natives-linux-amd64:2.2.0</include>
        <include>org.jogamp.gluegen:gluegen-rt:jar:2.2.0</include>
        <include>org.jogamp.gluegen:gluegen-rt:jar:natives-linux-amd64:2.2.0</include>
      </includes>
    </dependencySet>
  </dependencySets>
</assembly>

And here is my pom.xml :

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.loloof64.java</groupId>
    <artifactId>Simple3DCube</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>Simple3DCube</name>
    <description>A simple 3D Cube with JOGL</description>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.jogamp.gluegen</groupId>
            <artifactId>gluegen-rt-main</artifactId>
            <version>2.2.0</version>
        </dependency>
        <dependency>
            <groupId>org.jogamp.jogl</groupId>
            <artifactId>jogl-all-main</artifactId>
            <version>2.2.0</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.4.1</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <mainClass>com.loloof64.java.simple_3d_cube.Launcher</mainClass>
                            <packageName>com.loloof64.java.simple_3d_cube</packageName>
                        </manifest>
                    </archive>

                    <descriptors>
                        <descriptor>src/main/assembly/windows32-assembly.xml</descriptor>
                        <descriptor>src/main/assembly/windows64-assembly.xml</descriptor>
                        <descriptor>src/main/assembly/linux32-assembly.xml</descriptor>
                        <descriptor>src/main/assembly/linux64-assembly.xml</descriptor>
                        <descriptor>src/main/assembly/solaris32-assembly.xml</descriptor>
                        <descriptor>src/main/assembly/solaris64-assembly.xml</descriptor>
                        <descriptor>src/main/assembly/macosx-universal-assembly.xml</descriptor>
                    </descriptors>


                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
loloof64
  • 5,252
  • 12
  • 41
  • 78