Default Build Script

If you use jMonkeyEngine libraries together with the jMonkeyEngine SDK (recommended) then you benefit from the provided build script. Every new project comes with a default Ant script. The toolbar buttons and clean/build/run actions in the jMonkeyEngine SDK are already pre-configured.

Default Targets

The build script includes targets for the following tasks:

  • clean – deletes the built classes and executables in the dist directory.

  • jar – compiles the classes, bundles the assets, builds the executable JAR in the dist directory, copies libraries.

  • run – builds and runs the executable JAR (e.g. for the developers to test it).

  • javadoc – compiles javadoc from your java files into html files.

  • debug – used by the jMonkeyEngine SDK Debugger plugin.

  • test – Used by the jMonkeyEngine SDK JUnit Test plugin.

You can call these targets on the command line using default Ant commands:

ant clean
ant jar
ant run

We recommended to use the user-friendly menu items, F-keys, or toolbar buttons in the jMonkeyEngine SDK to trigger clean, build, and run actions.

Browsing the Build Script

To see the build script and the predefined tasks

  1. Open your project in the jMonkeyEngine SDK if it isn’t already open (File  Open Project)

  2. Open the “Files” window (Window  Files)

  3. Open the project node. You see build.xml listed.

    1. Double-click build.xml to see how the jme3-specify build targets were defined. You typically do not need to edit the existing ones, but you can.

    2. Click the triangle next to build.xml to see all targets.

      1. Double-click a target in the Files window, or the Navigator, to see how the target was defined.
        You will notice that the file nbproject/build-impl.xml opens. It contains very generic targets that you typically will never need to edit. Note that build.xml includes build-impl.xml!

Adding Custom Targets

build-impl.png

The build script is a non-proprietary Apache Ant script. It will work out-of-the-box, but if necessary, you can extend and customize it.

Read the comments in build.xml, they explain how to override targets, or extend them, to customize the build process without breaking the existing functionality.

Additionally, you can manually override the targets in the *-impl.xml files that are created when you change the deployment settings:

  • linuxlauncher-impl.xml,

  • macapp-impl.xml,

  • mobile-impl.xml,

  • jnlp-impl.xml, etc.

Simply copy&paste a target from these files into the main build.xml and that will be run instead with all modifications.

* Don’t edit the base -impl.xml files directly, if you deactivate and reactivate a deployment setting, the SDK resets these files, so you have to copy the whole target and its dependencies, else your build script will become invalid when you disable the deployment option.