maven2 artifacts?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

maven2 artifacts?

Cork
Has anyone done any work towards putting JOGL2 build artifacts into maven?  If not I might have a go myself...
Reply | Threaded
Open this post in threaded view
|

Re: maven2 artifacts?

gouessej
Administrator
Hi!

Cork wrote
Has anyone done any work towards putting JOGL2 build artifacts into maven?  If not I might have a go myself...
Maybe you can look at how it was handled for JOGL 1.1.1:
http://www.mvnbrowser.com/artifacts-browse.html?groupId=net.java.dev.jogl

It would very helpful for projects using Maven and JOGL 2: Ardor3D, JMonkeyEngine 3, NiftyGUI...
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: maven2 artifacts?

Cork
In reply to this post by Cork
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










Reply | Threaded
Open this post in threaded view
|

Re: maven2 artifacts?

Michael Bien
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













View message @ http://jogamp.762907.n3.nabble.com/maven2-artifacts-tp1935908p1942413.html
To start a new topic under jogamp, email [hidden email]
To unsubscribe from jogamp, click here.


-- 
- - - -
http://michael-bien.com
Reply | Threaded
Open this post in threaded view
|

Re: maven2 artifacts?

Cork
so I worked out the javadoc, in eclipse, not maven yet...  
Download this file 'jogl-javadoc.zip'.  You can leave it zipped.  
In eclipse select the jogl-all jar in eclipse and then 'properties'.  
Select the .zip file as an 'archive' source, and use the path:  jogl/javadoc

Next step is the sources... is there a .zip available for all the sources?

Would anyone be interested for me to try and host a nexus repository for this stuff once it up and running?

thanks Michael, I didn't find any reference to maven, apart from some people asking for it to be added, but I got the impression they were discussing the build process (which would be even better) but for now I just try to get some artifacts into a repo even if it's a manual process.  
Let me know if you think it's a waste of time, esp if the build is being migrated anyway to maven.
Reply | Threaded
Open this post in threaded view
|

Re: maven2 artifacts?

BrickFarmer
for anyone that's interested, here's my bash script I'm currently using to populate my maven repository:
jogl2maven.sh

example:
./jogl2maven.sh jogl-2.0-b242-20101129-macosx-universal.zip 2.0.242


If you define a property for the JOGL version you want to use, it makes switching between versions quite easy:

   <properties>
        <jogl.version>2.0.242</jogl.version>
    </properties>

Just remember that each time you change the property, you'll need to regenerate the eclipse project files with 'mvn eclipse:eclipse'  F5 in eclipse to refresh the project.  Then 're-attach' the native lib directory to each of the jar files as discussed previously.
Reply | Threaded
Open this post in threaded view
|

Re: maven2 artifacts?

BrickFarmer
slightly updated script that ensures the pom.xml files get created in your local repository, otherwise maven is checking the remote repository for jogl.

jogl2maven.sh
Reply | Threaded
Open this post in threaded view
|

Re: maven2 artifacts?

gouessej
Administrator
Is it now possible to use JOGL with Maven?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: maven2 artifacts?

BrickFarmer
>Is it now possible to use JOGL with Maven?

well this is a manual solution until JOGL makes it into an official repository...

I just noticed though that JOGL has switched to 7zip so the above script will fail (that's how I found this post, sorry for delay)

I wanted to add that you'll need to download zipeg under osx to be able to extract the files.

http://www.zipeg.com/

Since I haven't found a command line 7zip tool for OSX the easiest approach is then to zip it back up (using context menu compress) and then run the above bash script.