Skip to content

Instantly share code, notes, and snippets.

@tysonmalchow
Created January 17, 2012 04:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save tysonmalchow/1624599 to your computer and use it in GitHub Desktop.
Save tysonmalchow/1624599 to your computer and use it in GitHub Desktop.
install jogamp's JOGL and GLUEGEN jars to a local maven repository
#!/bin/bash
#filename specified
if [ $# != 3 ]; then
echo "usage: $0 distroUrl maven_repo version"
exit
else
echo "Processing: $1"
fi
BASEURL=$1
MVN_REPO=$2
VERSION=$3
TEMPFILE=./download/jogamp/$VERSION
mkdir -p "$TEMPFILE"
echo "using temp directory $TEMPFILE"
# base jogl class jar
echo "installing core jogl deps"
wget -nc $BASEURL/jar/jogl.all.jar.gz -O "$TEMPFILE/jogl.all.jar.gz"
gunzip "$TEMPFILE/jogl.all.jar.gz"
mvn install:install-file -Dversion=$VERSION -DlocalRepositoryPath="$MVN_REPO" -DgroupId=com.jogamp.jogl -DartifactId=jogl-all -Dpackaging=jar -Dfile="$TEMPFILE/jogl.all.jar" -DgeneratePom=true
echo "installing gluegen"
wget -nc $BASEURL/jar/gluegen-rt.jar -O "$TEMPFILE/gluegen-rt.jar"
mvn install:install-file -Dversion=$VERSION -DlocalRepositoryPath="$MVN_REPO" -DgroupId=com.jogamp.gluegen -DartifactId=gluegen-rt -Dpackaging=jar -Dfile="$TEMPFILE/gluegen-rt.jar" -DgeneratePom=true
# native jars
echo "installing native libs"
NATIVE_PLATFORMS="linux-amd64 linux-i586 macosx-universal solaris-amd64 solaris-i586 windows-amd64 windows-i586"
for platform in $NATIVE_PLATFORMS; do
echo " -> installing native lib for $platform"
wget -nc $BASEURL/jar/jogl-all-natives-$platform.jar -O "$TEMPFILE/jogl-all-natives-$platform.jar"
mvn install:install-file -DlocalRepositoryPath="$MVN_REPO" -Dclassifier="$platform" -Dversion=$VERSION -DgroupId=com.jogamp.jogl -DartifactId=jogl-natives -Dpackaging=jar -Dfile="$TEMPFILE/jogl-all-natives-$platform.jar" -DgeneratePom=true
wget -nc $BASEURL/jar/gluegen-rt-natives-$platform.jar -O "$TEMPFILE/gluegen-rt-natives-$platform.jar"
mvn install:install-file -DlocalRepositoryPath="$MVN_REPO" -Dclassifier="$platform" -Dversion=$VERSION -DgroupId=com.jogamp.gluegen -DartifactId=gluegen-natives -Dpackaging=jar -Dfile="$TEMPFILE/gluegen-rt-natives-$platform.jar" -DgeneratePom=true
done
<!-- note you'll probably want the OS-specific classifiers set using some maven magic to autodetect -->
<dependency>
<groupId>com.jogamp.jogl</groupId>
<artifactId>jogl-all</artifactId>
<version>2.0-rc5</version>
</dependency>
<dependency>
<groupId>com.jogamp.jogl</groupId>
<artifactId>jogl-natives</artifactId>
<version>2.0-rc5</version>
<classifier>windows-amd64</classifier>
</dependency>
<dependency>
<groupId>com.jogamp.gluegen</groupId>
<artifactId>gluegen-rt</artifactId>
<version>2.0-rc5</version>
</dependency>
<dependency>
<groupId>com.jogamp.gluegen</groupId>
<artifactId>gluegen-natives</artifactId>
<version>2.0-rc5</version>
<classifier>windows-amd64</classifier>
</dependency>
Copy link

ghost commented May 3, 2014

Thanks for posting this. Maven support has gotten better. You don't have to manually install the jogl and gluegen .jars any longer. The dependencies work to get all the native binaries too (I'm doing some WorldWind tutorials but you can leave those out if you're just using jogl.)

A problem with this is that all native .jars get included which you wouldn't want. For production use you would want to have platform specific build logic in maven (maybe a maven profile) to only include the correct native .jars for each platform.

<dependencies>
    <dependency>
        <groupId>gov.nasa</groupId>
        <artifactId>worldwind</artifactId>
        <version>2.0.0-986</version>
    </dependency>
    <dependency>
        <groupId>org.jogamp.gluegen</groupId>
        <artifactId>gluegen-rt-main</artifactId>
        <version>2.1.5-01</version>
    </dependency>
    <dependency>
        <groupId>org.jogamp.jogl</groupId>
        <artifactId>jogl-all-main</artifactId>
        <version>2.1.5-01</version>
    </dependency>
    <dependency>
        <groupId>gov.nasa</groupId>
        <artifactId>worldwindx</artifactId>
        <version>2.0.0-986</version>
    </dependency>
</dependencies>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment