JME3 - Maven

Hi



I created the maven repository of the JME3 project. What I need to do:



A. Dependencies

  1. Download all libraries that are necessary for the JME3

    ! I was confused a little bit because there are libraries without the version number or trunk version.
  2. Install to the repository each library with sources and javadoc if it is possible



    B. Build JME3
  3. Checkout the project
  4. Copy sources to the directory /src/main/java for each module



    3.  Fix source: move the

                /jme3_core/src/main/java/com/jme3/app/Application.java

        class to the directory

                /jme3_desktop/src/main/java/com/jme3/app/


  5. Rename project jme3_core_plugins to the project jme3_core-plugins
  6. Create parent and modules pom.xml.
  7. Build: mvn clean install
  8. Deploy to the repository: mvn deploy



    Maven repository web browser: http://www.ajka-andrej.com/maven-oss/



    Maven repository:


  <repository>
    <id>ajkaandrej-oss</id>
    <name>Ajka-Andrej server open source repository</name>
    <url>http://www.ajka-andrej.com/maven-oss/repository</url>
    <layout>default</layout>
  </repository>

Superb thing to have, andriu. I'll have to have a look at this, i'm big fan of Maven. Now if it could be possible to build the assets jme3 supports with a Maven task…that would be a perfect choice.



jme3 guys it would be nice to make the steps Andriu did in the repository of jME3, or even add pom.xml's to the SVN. Do you plan to do that?

Maven structure and pom.xml (see jme3_maven.zip)

andriu said:

Maven structure and pom.xml (see jme3_maven.zip)

Great!

Is it actually compiling the projects?

If so I think it's a must to integrate.

MomokoFan? What do you think? Me thinks, maven is cool..

Very cool! Glad to have Maven work with jME3.


I was confused a little bit because there are libraries without the version number or trunk version.

Okay, so should the version number be appended to the library jars then? (e.g jogl-1.1.1.jar, etc)?

Fix source: move the
            /jme3_core/src/main/java/com/jme3/app/Application.java
    class to the directory
            /jme3_desktop/src/main/java/com/jme3/app/

This isn't necessary. You can just combine the core and desktop modules into one module so it compiles. You will need a completely different project for android anyway.
Momoko_Fan said:

Okay, so should the version number be appended to the library jars then? (e.g jogl-1.1.1.jar, etc)?


I think this is not necessary for the Ant build. But for maven build you need to know the version of the library. There are some libraries in JME3 SVn, where I can't find the version number of the library. For example jBullet (I think it's trunk version).

It could be helpful:
- when there is a list of libraries with the version
- or like you wrote <lib>-<version>.jar

I've already installed all libraries with source and javadoc in my repository.

It would be nice to have www.jmonkeyengine.com/maven repository.

Hi,



I created my first JM3 project with maven. This is my pom.xml:



Profiles:

  • lwjgl -> default active
  • jogl



<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.ajkaandrej.jme3</groupId>
  <artifactId>example1</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>JME3 example1</name>
  <url>http://www.ajka-andrej.com/</url>
 
   <!-- Maven repository -->
    <repositories>
        <repository>
            <id>ajkaandrej-oss</id>
            <name>Ajka-Andrej OSS Repository</name>
            <url>http://www.ajka-andrej.com/maven-oss/repository</url>
            <layout>default</layout>
            <snapshots />
            <releases />
        </repository>
    </repositories>
   
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>com.jme3</groupId>
      <artifactId>desktop</artifactId>
      <version>3.0-SNAPSHOT</version>
      <type>jar</type>
    </dependency>
    <dependency>
      <groupId>com.jme3</groupId>
      <artifactId>desktop-fx</artifactId>
      <version>3.0-SNAPSHOT</version>
      <type>jar</type>
    </dependency>
    <dependency>
      <groupId>com.jme3</groupId>
      <artifactId>ogre</artifactId>
      <version>3.0-SNAPSHOT</version>
      <type>jar</type>
    </dependency>
    <dependency>
      <groupId>com.jme3</groupId>
      <artifactId>xml</artifactId>
      <version>3.0-SNAPSHOT</version>
      <type>jar</type>
    </dependency>
    <dependency>
      <groupId>net.java.dev.swing-layout</groupId>
      <artifactId>swing-layout</artifactId>
      <version>1.0.3</version>
      <type>jar</type>
    </dependency>
  </dependencies>

  <profiles>
      <profile>
           <id>lwjgl</id>
           <activation>
               <activeByDefault>true</activeByDefault>
           </activation>
           <dependencies>
                <dependency>
                  <groupId>com.jme3</groupId>
                  <artifactId>lwjgl-oal</artifactId>
                  <version>3.0-SNAPSHOT</version>
                  <type>jar</type>
                </dependency>
                <dependency>
                  <groupId>com.jme3</groupId>
                  <artifactId>lwjgl-ogl</artifactId>
                  <version>3.0-SNAPSHOT</version>
                  <type>jar</type>
                </dependency>
                <dependency>
                    <groupId>com.jme3</groupId>
                    <artifactId>lwjgl</artifactId>
                    <version>2.1.0</version>
                    <classifier>natives</classifier>
                    <type>jar</type>
                </dependency>
           </dependencies>
      </profile>
      <profile>
           <id>jogl</id>
           <dependencies>
                <dependency>
                    <groupId>net.java.gluegen</groupId>
                    <artifactId>gluegen</artifactId>
                    <version>1.1.2</version>
                </dependency>
                <dependency>
                  <groupId>com.jme3</groupId>
                  <artifactId>joal</artifactId>
                  <version>3.0-SNAPSHOT</version>
                  <type>jar</type>
                </dependency>
                <dependency>
                  <groupId>com.jme3</groupId>
                  <artifactId>jogl</artifactId>
                  <version>3.0-SNAPSHOT</version>
                  <type>jar</type>
                </dependency>
                <dependency>
                    <groupId>com.jme3</groupId>
                    <artifactId>joal</artifactId>
                    <version>1.1.2</version>
                    <classifier>natives</classifier>
                    <type>jar</type>
                </dependency>
                <dependency>
                    <groupId>com.jme3</groupId>
                    <artifactId>jogl</artifactId>
                    <version>1.1.1</version>
                    <classifier>natives</classifier>
                    <type>jar</type>
                </dependency>
           </dependencies>
      </profile>
  </profiles>
</project>

There are two maven poms being made right now (see here), I think we need something final. Also, it should support all packages including jogg, joal, lwjgl-oal, etc. Then we can include it.

The two poms seem to accommodate one another. If they were merged I think we'd cover all our bases. If someone could please submit a merged version we'd have a wiki page for jME3 maven up in no time :slight_smile:

Just for clarity there's two pom.xml files that would be useful:


  1. A pom.xml inside JME3's structure to build the JME3 jar using maven
  2. An example (template) pom.xml that game developers can copy to get started



    The first is useful but not critical (it would just make it easier for JME3 contributors to build). You can get away with using ant files and just manually upload the resulting jars to a Maven repository if that is your preference.



    The second is critical in order to support game developers who want to use Maven (like me). In order to make this we just need to get the JME3 jar and all it's dependent jars into a repository with the correct versions. The native files add a bit of a challenge, and we would probably want to bundle these differently to work with Maven but this is a solvable problem.



    I have just been through the process of setting up my maven environment (taking yet another approach to the ones the guys have outlined above). I've documented my clunky steps here:



    EDIT: I've fixed the way I was doing native files. I had thought that the extraction mechanism from the jar wasn't working with Maven, but it was. The result is much cleaner:



      https://www.assembla.com/wiki/show/jmonkeyplay/Setup_JMonkey

      https://www.assembla.com/wiki/show/jmonkeyplay/Create_a_Simple_Project



    I don't think my solution is any better than the ones suggested but it also works.



    To avoid people coming up with seperate (hacky) solutions to the Maven issue it would be great if we could get an 'official' maven repo that we could use with confidence, or even better get the JME3 jars into the Central Maven repo: http://maven.apache.org/guides/mini/guide-central-repository-upload.html





    If the official JME3 release process could include deploying jars into the official repo then life would be pretty good and newbies starting out in JME3 could rapidly get into it.



    I'd be happy to help setup a solution that works, however I would need some help from someone in the team. First thing we need to do is identify which versions of the 3rd party libraries JME3 is using (i.e. the versions of the jars in the lib directory) so we can work out if these are already in a Maven repository.


I've got python script which scans directory and converts present jar's names to mvn install command.

For example it converts swing-layout-1.0.4.jar



to something like


mvn install:install-file -Dfile=lib/swing-layout-1.0.4.jar -DartifactId=swing-layout -DgroupId=swing-layout -Dversion=1.0.4 -Dpackaging=jar


I'm glad to provide it, if it will be in any help.
But there still need a solution for libs that do not have version in the name.

Ok so below is a list of all the Jars in the jMonkey3 'lib' directory. We need a version and a groupId (typically the producers website URL) for each of these. I've had a stab at these but I really need someone who's worked on it to provide the details:




















JAR ARTIFACT_ID GROUP_ID VERSION
gluegen-rt.jar gluegen-rt? com.sun.gluegen? 20100511?
j-ogg-oggd.jar j-ogg-oggd? de.jarnbjo? ?
j-ogg-vorbisd.jar j-ogg-vorbisd? de.jarnbjo? ?
jbullet.jar jbullet com.bulletphysics 20090628?
jheora-debug-0.6.0.jar jheora-debug? com.fluendo ?
jinput.jar jinput net.java.games 20100503?
joal.jar joal net.java.games 1.1.2?
jogl.jar jogl com.sun.opengl b120-2010-05-16_19-21-22?
lwjgl.jar lwgl org.lwgl 2.4.2
nifty-1.2-SNAPSHOT-2.jar nifty de.lessvoid 1.2-SNAPSHOT
nifty-default-controls-1.1.jar nifty-default-controls de.lessvoid 1.1
nifty-style-black-1.1-sources.jar nifty-style-black de.lessvoid 1.1
stack-alloc.jar stack-alloc cz.advel 20080716
swing-layout-1.0.4.jar swing-layout org.swinglabs 1.0.4
vecmath.jar vecmath java3d 1.3.1
xmlpull-xpp3-1.1.4c.jar xmlpull-xpp3 org.xmlpull 1.1.4c



Are either 'jme3testdata.jar' or 'nifty-examples-1.1.jar' needed to work with jMonkey? Looks like demo stuff, in which case we won't need it in our builds.

Once we get the above sorted we can sort out the Native libraries.

jbullet is our "own" version of jbullet, theres some additions to it, its the version from this branch: http://code.google.com/p/jbullet-jme/source/browse/#svn/branches/jbullet maybe you can call it jme-r555 or something.

The two jars are demo data, right.

The J-Ogg/J-Vorbis libs are available here:

http://www.j-ogg.de/core/main?/download-libraries.html

There's no version number on them, I guess you can just call it 1.0



jheora-debug-0.6.0.jar is based on "cortado-ovt-debug-0.6.0.jar" available here: http://downloads.xiph.org/releases/cortado/

with all GPL code stripped.

Ok, Maven plays best with 'released' libraries. Using modified code, etc is more problematic but we can find work-arounds. I guess that's the result of using cutting edge technologies.



In better news (for me anyway), I discovered that your technique of copying native files from the jar actually works fine through Maven (I had problems with it and just assumed it wouldn't work). So this has really simplified the Maven setup and I've updated my notes to match:



  https://www.assembla.com/wiki/show/jmonkeyplay/Setup_JMonkey       

  https://www.assembla.com/wiki/show/jmonkeyplay/Create_a_Simple_Project



I'd still like to resolve the version issues and get this into a repo but this may take a while. I'm looking into repo options.



In the meantime I'd be keen to setup an example of a Maven project that builds a webstart deployment bundle for a simple jMonkey3 project.



Are there any (non-maven) examples of jme3 + webstart out there yet (i.e. jnlp files)?



If not, how do you see the native jar files working through webstart, should I be manually extracting and re-jarring them for different operating systems?