This made me so happy I thought I should share it with the rest of you.
First of all, I like NetBeans 6.1, Maven 2 and the Maven plugin that adds support for the latter to the former. This is for people who have this is common with me (or want to try something new) and would like to use Maven for projects that use jMonkeyEngine.
My goal was clear: Create a portable project structure. To be portable, the project structure should not require anyone to install non-mavenized jars (such as jME and lwjgl) into his or her local repository.
Here's the recipe:
- Create a maven project (use NB to do this if you like).
- Copy all of lwjgl's native dependencies (for your platform) into your project's base directory.
- Create a directory in your project's base directory called "lib".
- Copy all the jars from the releases of jMonkeyEngine and lwjgl into lib.
- Add the following to the dependencies section in your pom:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jme</groupId>
<artifactId>jme</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/jme.jar</systemPath>
</dependency>
<dependency>
<groupId>jme</groupId>
<artifactId>jme-audio</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/jme-audio.jar</systemPath>
</dependency>
<dependency>
<groupId>jme</groupId>
<artifactId>jme-awt</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/jme-awt.jar</systemPath>
</dependency>
<dependency>
<groupId>jme</groupId>
<artifactId>jme-collada</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/jme-collada.jar</systemPath>
</dependency>
<dependency>
<groupId>jme</groupId>
<artifactId>jme-editors</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/jme-editors.jar</systemPath>
</dependency>
<dependency>
<groupId>jme</groupId>
<artifactId>jme-effects</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/jme-effects.jar</systemPath>
</dependency>
<dependency>
<groupId>jme</groupId>
<artifactId>jme-font</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/jme-font.jar</systemPath>
</dependency>
<dependency>
<groupId>jme</groupId>
<artifactId>jme-gamestates</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/jme-gamestates.jar</systemPath>
</dependency>
<dependency>
<groupId>jme</groupId>
<artifactId>jme-model</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/jme-model.jar</systemPath>
</dependency>
<dependency>
<groupId>jme</groupId>
<artifactId>jme-scene</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/jme-scene.jar</systemPath>
</dependency>
<dependency>
<groupId>jme</groupId>
<artifactId>jme-terrain</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/jme-terrain.jar</systemPath>
</dependency>
<dependency>
<groupId>jme</groupId>
<artifactId>jme-xml</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/jme-xml.jar</systemPath>
</dependency>
<dependency>
<groupId>lwjgl</groupId>
<artifactId>lwjgl</artifactId>
<version>1.1.4</version>
<scope>system</scope>
<systemPath>${basedir}/lib/lwjgl.jar</systemPath>
</dependency>
<dependency>
<groupId>lwjgl</groupId>
<artifactId>lwjgl_test</artifactId>
<version>1.1.4</version>
<scope>system</scope>
<systemPath>${basedir}/lib/lwjgl_test.jar</systemPath>
</dependency>
<dependency>
<groupId>lwjgl</groupId>
<artifactId>lwjgl_util</artifactId>
<version>1.1.4</version>
<scope>system</scope>
<systemPath>${basedir}/lib/lwjgl_util.jar</systemPath>
</dependency>
<dependency>
<groupId>lwjgl</groupId>
<artifactId>lwjgl_util_applet</artifactId>
<version>1.1.4</version>
<scope>system</scope>
<systemPath>${basedir}/lib/lwjgl_util_applet.jar</systemPath>
</dependency>
<dependency>
<groupId>jinput</groupId>
<artifactId>jinput</artifactId>
<version>unknown</version>
<scope>system</scope>
<systemPath>${basedir}/lib/jinput.jar</systemPath>
</dependency>
6. Create a class containing a main method that uses jMonkeyEngine. If you don't have anything, just copy and paste one of the demos.
7. Right-click on said class and select "Run File".
Now I'll duck for cover while all the Maven purists flame me for abusing the system scope. :P