Last update: Edit

1 Introduction

MxBuild is a Windows and Linux command-line tool that can be used to build a Mendix Deployment Package from a Mendix Project.

The version of MxBuild which you need is dependent on the version of the Mendix model you want to build. You can find the correct MxBuild download at a link with the format{mxversion}.tar.gz.

So, MxBuild for Mendix version 7.18.1 is found at

You can extract the files using your favorite archival tool, such as 7-Zip.

The system requirements for MxBuild are documented here: System Requirements.

2 Command Line

To build your package, you specify the Mendix Project file (.mpr) for which you want to build the deployment package (.mda) on the command-line. The file name may be preceded by a relative or absolute path. The project file should be located inside a Mendix project directory.

MxBuild takes a number of command-line options which control how the Mendix project is processed. These options precede the name of the project file.

In Windows, use the following format for the command line:

MxBuild --java-home="JDKDirectory" --java-exe-path="javaExecutable" [options] projectFile

You can also run MxBuild under Linux using the the following command line format:

mono mxbuild.exe --java-home="JDKDirectory" --java-exe-path="javaExecutable" [options] projectFile

After creating the deployment package, the MxBuild process quits.

2.1 General Command-Line Options

Option                                  Description
-h, --help prints a short description of MxBuild and a list of all available options.
--java-home=DIRECTORY (required) the directory in which the JDK is installed
for example: --java-home=/usr/lib/jvm/java-8-oracle
for Windows the DIRECTORY should be enclosed in double-quotes, ".
--java-exe-path=FILENAME (required) the full path to the Java executable
for example --java-exe-path=/usr/lib/jvm/java-8-oracle/bin/java
for Windows the DIRECTORY should be enclosed in double-quotes, ", and must contain the complete file name ...\java.exe.
––target=[package|deploy] package (default if option is omitted): create a deployment package (.mda file)
deploy: make a deployment of the project without making a deployment package.
--loose-version-check create a deployment package from a project which was created with a lower Mendix version.
The project will be upgraded to the MxBuild version before the deployment package is created.
Any changes included as a result of this upgrade will not be stored in your project.
--write-errors=FILENAME Write all errors, warnings and deprecations encountered during deployment of the project to the specified file in JSON format.
This file is only written when the project contains errors.
If the file already exists, it will be overwritten without warning.
See section 4, Project Errors for a description of the format of this file.

2.2 Options When Creating a Package

Option                                                       Description
The name (with optional relative or absolute path) of the .mda file that is created by MxBuild.
If this option is omitted, the file will be saved in the current directory with the name out.mda.
--project-name=NAME Change the name of the application as used by the Mendix Runtime.
When this option is not specified, the name of the project is used.
--model-version=VERSION Apply a specific version number to the model in the package.
--model-description=DESCRIPTION Embed a description of the model in the package.

For example, to create a deployment package out.mda in the current directory using the app MyApp using the Windows version of MxBuild, you could use the command:

mxbuild --target=package --java-home="C:\Program Files\Java\jdk1.8.0_144" --java-exe-path="C:\Program Files\Java\jdk1.8.0_144\bin\java.exe" "C:\Users\username\Documents\Mendix\MyApp\MyApp.mpr"

3 Return Code

When MxBuild exits, one of the following codes will be returned:

Exit Code Description
0 MxBuild finished successfully
1 An internal error occurred
2 There’s something wrong with the command-line options
3 Deployment of the Mendix project failed

If the exit code is larger than 0, MxBuild will also output a message describing the error.

4 Project Errors

When your Mendix project contains errors, deployment will fail and MxBuild will report these errors. You can use the --write-errors=FILENAME command-line option to tell MxBuild to write the errors to a file.

The errors are output as a JSON object that has one property: problems. The value of this property is an array of objects that each describe one error, warning, or deprecation in your project. For example:

  "problems": [
      "name": null,
      "severity": "Error",
      "message": "Start event cannot be the last object of a flow.",
      "locations": [
          "elementId": "252e1008-d795-4e49-b3e3-2ba38eb0a56d",
          "unitId": "1a8a3593-6f01-43a3-bc22-bd22f9244983",
          "element": "Start event",
          "document": "Microflow 'MyMicroflow'",
          "module": "MyModule"

The following table describes the various properties of the problems JSON object:

Property Description
name A unique identifier of the problem, or null when the consistency check is not yet defined in the Mendix Metamodel.
severity Describes the type of problem: Warning, Error or Deprecation.
message The description of the problem. This is the same as the message in the ‘Errors’ dock of the Mendix Modeler.
locations Contains zero or more objects that describe the location in the Mendix project where the problem occurs (see the following table).

The location(s) associated with the problem have the following properties:

Property Description
elementId The unique id of the model element in which the problem occurs.
unitId The unique id of the document in which the problem occurs.
element A description of the model element in which the problem occurs.
document A description of the document in which the problem occurs.
module A description of the module in which the problem occurs.