= Building jMonkeyEngine 3 from the Sources
:author:
:revnumber:
:revdate: 2016/03/17 20:48
:keywords: documentation, install
:relfileprefix: ../
:imagesdir: ..
ifdef::env-github,env-browser[:outfilesuffix: .adoc]


== Foreword

Please understand that this tutorial gives you access to the latest development release of the engine. Whilst many developers 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 <<jme3/maven#,stable releases>>.


== Build jMonkeyEngine from Github source.

Here is the basic outline of our goal:

.  Install git client.
.  Download jMonkeyEngine using git-client.
.  Update jMonkeyEngine using git-client.
.  Build jMonkeyEngine locally using gradle.

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

. Install Git Client: +
website: link:https://git-scm.com/downloads[https://git-scm.com/downloads]

Now we need to get the engine source using the git client and build it locally. There are 3 batch files below provided for convenience (download, update, build) and can all be placed in the same directory and run without administrator privileges. For example, you can put all of these files into `D:\programming\` - and the scripts will create, download and update files in the `./jmonkeyengine/` sub-directory.

[start=2]
.  Download the Engine: `download.bat` +
 This file downloads the engine into a dir called "`jmonkey`" using the git client.
.  Update the Engine: `update.bat` +
 This file downloads any changed files from github using the git client.
.  Build the Engine: `build.bat` +
 This file builds the engine using the gradle wrapper and places them in your local repository.
+
--
NOTE: This is USER-SPECIFIC. My files are stored in `C:\Users\James\.m2\repository`

.download.bat
----
@echo off
echo "downloading engine..."
git clone -b master --single-branch --depth 10 https://github.com/jMonkeyEngine/jMonkeyEngine/ jmonkeyengine
----

.build.bat
----
@echo off

echo "Building JME engine to your local maven repo...."
cd jmonkeyengine
gradlew.bat -PbuildJavaDoc=true install
cd ..

cmd /k
----

.update.bat
----
@echo off
cd jmonkeyengine
git pull
cd ..
cmd /k
----
--

== 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()
    jcenter()
}

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

//For a detailed description of the created jar files see <<jme3/jme3_source_structure#structure_of_jmonkeyengine3_jars,this list>>.

'''

Learn more about:

*  <<jme3/simpleapplication_from_the_commandline#,Setting up JME3 on the commandline (generic)>>.
*  <<jme3/build_jme3_sources_with_netbeans#,Building JME3 from the sources with NetBeans>>
