Build JME Engine from github sources

Disclaimer

Please understand that this tutorial gives you access to the latest development release of the engine. Whilst i and many others use this release to work with, it is by definition still being developed. Expect bleeding edge implementations to need work. If you don’t want that kind of hassle, please use the stable releases.


How to build jMonkeyEngine from GitHub source.

Here is the basic outline of our goal:

  1. Install git client - Git - Downloads
  2. download jMonkeyEngine using git-client.
  3. update jMonkeyEngine using git-client.
  4. build jMonkeyEngine locally using gradle.

Repeat steps 3 and 4 whenever any changes have been committed to the master branch.

  1. Install Git Client
    website: Git - Downloads

That’s it for configuring our environment. Now we just need to get the engine and build it. The files below can all be placed in the same directory and run without admin privileges. For example, I put all of these files into D:\programming - and they will download/update files in the ./jmonkeyengine/ sub-directory.

  1. Download the Engine: download.bat
    This file downloads the engine into a dir called “jmonkey” using the git client.

  2. Update the Engine: update.bat
    This file downloads any changed files from github using the git client.

  3. Build the Engine: build.bat
    This file builds the engine using the gradle wrapper and places them in your local repository. Note that this is USER-SPECIFIC. My files are stored in C:\Users\James\.m2\repository

https://gist.github.com/jayfella/12af46c2fc4650640652b69b84b3dd01

Using the built engine in your game

Add the maven plugin to your build script, and put the mavenLocal() repository in your list of repositories. Then just reference the dependencies as you would normally. Note that we are now using version 3.2.+ of the engine.

apply plugin: 'maven'

ext.jmeVersion = "[3.2,)"

repositories {
    mavenLocal()
}

dependencies {
    compile "org.jmonkeyengine:jme3-core:$jmeVersion"
    compile "org.jmonkeyengine:jme3-desktop:$jmeVersion"
    compile "org.jmonkeyengine:jme3-lwjgl:$jmeVersion"
}

4 Likes

what about gradle wrapper?

1 Like

I just downloaded the complete package. I tested it on a VM and it seemed fine, unless theres something i dont understand?

You’re invoking the gradlew.bat file inside the jmonkeyengine repo – that’s the gradle wrapper. So you don’t actually need to install gradle as its already included in the GIT repo.

3 Likes

Oh i see. Even easier. I shall ammend the OP.

Edit: ammended. Thank you @javasabr and @Momoko_Fan

1 Like

Is this a good replacement for this?
https://jmonkeyengine.github.io/wiki/jme3/build_from_sources.html

Yes. A far more appropriate place, too.

Can this page be updated to work with your procedures?
https://jmonkeyengine.github.io/wiki/jme3/jme3_source_structure.html#structure_of_jmonkeyengine3_jars

If so, please suggest changes. this applies to everyone who can help, not just jayfella.

Please review the page now and suggest changes if any.
https://jmonkeyengine.github.io/wiki/jme3/build_from_sources.html

I’ve tidied it up a little. Thanks @mitm

What does the directory structure look like after running build.bat?

Edit:
I am almost finished updating this page which is linked to from your page,
https://jmonkeyengine.github.io/wiki/jme3/simpleapplication_from_the_commandline.html#installing-the-jme3-framework

I need to change this,

Alternatively, you can build JME3 from the sources. (Recommended for JME3 developers.)

svn checkout https://jmonkeyengine.googlecode.com/svn/branches/3.0final/engine jme3
cd jme3
ant run
cd ..

and this,

If you have built JME3 from the sources, then the copy paths are different:

mkdir HelloJME3/build
mkdir HelloJME3/lib
cp jme3/dist/*.* HelloJME3/lib

to finish and I don’t want to install Git.

Thank you for posting this guide.

I wanted to try dealing with some of the issues I saw on github. I have 3.2 and cannot recreate an issue so am trying to test with the latest master. Bearing in mind I have never used github, maven or built anything before, could anyone please expand on step 4?

Using the built engine in your game

Add the maven plugin to your build script, and put the mavenLocal() repository in your list of repositories. Then just reference the dependencies as you would normally. Note that we are now using version 3.2.+ of the engine.

I have installed git-client, run download update and build, and have this large file structure ‘jmonkeyengine’ with all the relevant folders and source files. Not sure what I do next.

Please give me an hour when I start work tomorrow and I’ll upload the GUI app I made that makes all of this irrelevant. I’ve been meaning to for a few days now.

2 Likes

But to answer your question you just need to reference version 3.2+ now just like you would reference it in your build.gradle and it will detect and use the latest version of your local maven copy. By adding mavenlocal you add your local builds to the list of available repositories. Your local copy will be the latest.

Like below, but for 3.2 not 3.1.

Note that you could also use BootMonkey which does this exact thing.

mkdir jmonkeyengine
cd jmonkeyengine

// if you have a rsa key configured
git clone git@github.com:jMonkeyEngine/jmonkeyengine.git 
// or 
// if you don't, but you'll be asked credential after the next command
git clone https://github.com/jMonkeyEngine/jmonkeyengine.git 
//can take a while

// build the engine and install it in your local maven repo.
./gradlew install 

Then you can use bootmonkey to create a new project. or clone this:

or this

In the build.gradle file make sure you have maven local in your repositories

Important note: If you are pulling the engine to make a pull request, it’s gonna be easier to directly work in the jme3-example project. Copy one of the existing example and do your test case with it.
You won’t have to gradlew install each time you change something in the engine.

Two things worth noting:
The first two commands are unnecessary since it git clone already creates a directory for you, however here it would be named jmonkeyengine.git probably (but at least for the https clone you can also leave the .git out, not sure about the ssh command).

But the more important thing:
If you are working on a pull request and hence work on a separate branch (e.g. fix-issue-xyz), then your jME Version will change. The engine will print out a “POM VERSION” during the install command. Note it down and use it as ext.jmeVersion. (You only need this when you’ve installed more than one engine build).

I’m not sure if this is required or if gradle always picks the latest build but that way you can ensure that you are really using the real engine version.

I use netbeans with git so I need to clarify a few things with regards to command line cloning templates.

When I clone the Nehon/base-jme with netbeans it creates a subproject with the assets folders for me and a blue cube example file under Source Packages.

Will the same thing happen with shell command line clone or will they need to execute task commands?

The clone is basically a download of the files in the repo. It just copies files in place it doesn’t do any post treatment.
So yes, the project will have the same structure.

Thanks.