Re: maven2 artifacts?
Posted by
Michael Bien on
Nov 22, 2010; 10:45am
URL: https://forum.jogamp.org/maven2-artifacts-tp1935908p1944942.html
hi cork,
at least one other contributer said that (s)he is/was working on it.
Not sure about the status. But there are already a few utility ant
targets in maven-common.xml (gluegen).
just fyi,
best regards,
michael
On 11/21/2010 11:23 PM, Cork [via jogamp] wrote:
well I spent today playing around with the idea, and
I eventually got something working, but I'm not too pleased with
the end result. but here's a rough description for anyone trying
to do the same:
firstly my setup: osx 10.6.4, eclipse 3.5.0, maven 2.2.0
check your maven with:
mvn --version
my eclipse workspace:
/Users/peter/workspace
default location for maven repository:
/Users/peter/.m2/repository
configure eclipse for use with maven:
mvn -Declipse.workspace=/Users/peter/workspace
eclipse:add-maven-repo
alternatively manually add a 'classpath variable'
(settings->java->buildpath)
name: M2_REPO
path: /Users/peter/.m2/repository
restart eclipse.
generate a simple java project (see: http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html):
cd workspace
mvn archetype:generate -DgroupId=com.sunshineapps.quickie
-DartifactId=quickie
-DarchetypeArtifactId=maven-archetype-quickstart
-DinteractiveMode=false
cd quickie
build:
mvn package
run with:
java -cp
/Users/peter/workspace/quickie/target/quickie-1.0-SNAPSHOT.jar
com.sunshineapps.quickie.App
create the eclipse project files:
mvn eclipse:eclipse
start eclipse and 'import existing project'. should also run fine
from here. Next we add JOGL:
download JOGL, I used the following build:
http://jogamp.org/deployment/jogamp-next/
jogl-2.0-b220-20101117-macosx-universal.zip 17-Nov-2010 14:19 10M
and unzip it.
from the lib directory we build some zips for the natives:
zip jogl-natives.zip libjogl*
zip gluegen-natives.zip libglue*
zip nativewindow-natives.zip libnativewindow_awt.*
next we need to install these into our local repository along with
the matching jar files:
mvn install:install-file -DgroupId=com.jogamp.jogl
-DartifactId=jogl-all -Dversion=2.0-SNAPSHOT -Dpackaging=jar
-Dfile=jogl-all.jar
mvn install:install-file -DgroupId=com.jogamp.jogl
-DartifactId=jogl-natives -Dversion=2.0-SNAPSHOT
-Dclassifier=osx-universal -Dpackaging=zip -Dfile=jogl-natives.zip
mvn install:install-file -DgroupId=com.jogamp.gluegen
-DartifactId=gluegen-rt -Dversion=2.0-SNAPSHOT -Dpackaging=jar
-Dfile=gluegen-rt.jar
mvn install:install-file -DgroupId=com.jogamp.gluegen
-DartifactId=gluegen-natives -Dversion=2.0-SNAPSHOT
-Dclassifier=osx-universal -Dpackaging=zip
-Dfile=gluegen-natives.zip
mvn install:install-file -DgroupId=com.jogamp.nativewindow
-DartifactId=nativewindow -Dversion=2.0-SNAPSHOT -Dpackaging=zip
-Dfile=nativewindow.all.jar
mvn install:install-file -DgroupId=com.jogamp.nativewindow
-DartifactId=nativewindow-natives -Dversion=2.0-SNAPSHOT
-Dclassifier=osx-universal -Dpackaging=zip
-Dfile=nativewindow-natives.zip
the 'classifier' allows us to easily add other platforms in the
same artifact repo.
next edit the pom.xml in the sample project we created, adding:
<dependency>
<groupId>com.jogamp.jogl</groupId>
<artifactId>jogl-all</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.jogamp.jogl</groupId>
<artifactId>jogl-natives</artifactId>
<version>2.0-SNAPSHOT</version>
<classifier>osx-universal</classifier>
<type>zip</type>
</dependency>
<dependency>
<groupId>com.jogamp.gluegen</groupId>
<artifactId>gluegen-rt</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.jogamp.gluegen</groupId>
<artifactId>gluegen-natives</artifactId>
<version>2.0-SNAPSHOT</version>
<classifier>osx-universal</classifier>
<type>zip</type>
</dependency>
<dependency>
<groupId>com.jogamp.nativewindow</groupId>
<artifactId>nativewindow</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.jogamp.nativewindow</groupId>
<artifactId>nativewindow-natives</artifactId>
<version>2.0-SNAPSHOT</version>
<classifier>osx-universal</classifier>
<type>zip</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>generate-sources</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/lib</outputDirectory>
<includeTypes>zip</includeTypes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
regenerate the eclipse project files, and press f5 on the project
to refresh:
mvn eclipse:eclipse
I probably missed a 'mvn install' somewhere along the way...
next you need to click each of the 3 included jar files in eclipse
to set the properties, for each one point the native libs
directory to lib. I need to work out the best way to separate the
native files into sub directories, otherwise we could have a
single native zip file for all natives...
To test this I took the JOGL2 code for JOGLTetrahedron from
wikipedia (paste source into src folder in eclipse).
native libs reference: http://docs.codehaus.org/display/MAVENUSER/Projects+With+JNI
What next?
Well it would be really nice if the JOGL build was generating some
maven artifacts by default, possible just using ant buildnumber
and some renaming for now, or making use of this ant task to
generate the artifacts: http://maven.apache.org/ant-tasks/index.html
I still have no idea what 80% of the jar files and natives are
used for, or how they depend on each other. eg it seemed strange
to have a gluegen-rt dependency for some buffer utils? although
maybe a common jar is just adding to the noise until we have all
the dependencies in place.
would be nice to have a jogl archetype for newt and awt so people
have a good template starting point for building apps.
haven't thought about webstart with this yet.
would be good to get some javadoc and sources attached, but that
should be quite easy once I find the relevant downloads
--
- - - -
http://michael-bien.com