App Commands

Last modified: December 5, 2024

Introduction

The commands in this group are related to Mendix app creation, checking, versioning, and conversion.

Typically, these commands require a path to the .mpr file as a parameter.

mx create-project Command

The mx create-project command creates a new app in Studio Pro. The app version depends on the version the tool was bundled with. For example, if you are using the mx tool for Studio Pro 10.0.0, mx create project will create a new app in that version.

Usage

Use the following command pattern: mx create-project [OPTIONS] [TEMPLATE-MPK-FILE]

These are the OPTIONS:

Option Default Value Result
--app-name App Assigns the specified app name to the app.
--help Shows help for the mx create-project command and exits.
--language-code en_US The default language of the app.
--output-dir Current directory The directory in which to create the app.
--sprintr-app-id Optional Associates the app feedback features with the provided app in Apps. The value is a GUID. When accessing the app in Apps, this ID can be found in the browser’s URL (for example, 1a428ea7-b00e-4166-9b23-20b7be88a40e).

TEMPLATE-MPK-FILE is an optional path to a Mendix app package .mpk file. If this argument is omitted, the app is created with a default empty project template.

Examples

These are example commands:

Example Result
mx create-project Creates an app in the current folder using all the default parameters.
mx create-project --app-name MyFirstApp --output-dir C:\Projects\MyFirstApp Creates an app named MyFirstApp in the C:\Projects\MyFirstApp folder using all the default parameters.
mx create-project C:\Templates\ExpenseReportTemplate.mpk Creates an app with the default parameters from a template located at C:\Templates\ExpenseReportTemplate.mpk.

Return Codes

These are the return codes:

Return Code Description
0 The app creation was successful.
1 An internal error occurred.
2 There is something wrong with the command-line options.

mx show-version Command

The mx show-version command reports which version of Studio Pro was used last time the app was opened.

The input is a single .mpr file.

Usage

Use the following command pattern for mx show-version:

mx show-version [OPTIONS] INPUT

These are the OPTIONS:

Option Result
--help Shows help for the mx show-version command and exits.

For INPUT, enter an .mpr file.

Examples

These are example commands:

Example Result
mx show-version --help Displays the help text for the show-version command.
mx show-version C:\Mendix\App1\App1.mpr Displays the version of Studio Pro that was last used to open the app.

Return Codes

These are the return codes:

Return Code Description
0 The command ran successfully.

mx show-java-version Command

The mx show-java-version command reports what the configured Java version of the app is.

The input is a single MPR file.

Usage

Use the following command pattern for mx show-java-version:

mx show-java-version INPUT

For INPUT, enter an .mpr file.

Examples

Examples of commands are described in the table below:

Example Result
mx show-java-version C:\Mendix\App1\App1.mpr Displays the configured Java version of the app.

Return Codes

Return codes are described in the table below:

Return Code Description
0 The command ran successfully.
1 The command failed. For example because the .mpr file could not be found.

mx convert Command

The mx convert command converts the .mpk file (or files) of the app (or apps) to a specific Studio Pro version. For example, if you are using the mx command-line tool for Studio Pro 10.0.0, mx convert will convert the app to that version.

The input can be a single file, directory, or multiple files.

Usage

Use the following command pattern for mx convert:

mx convert [OPTIONS] INPUT... OUTPUT

These are the OPTIONS:

Option Shortcut Result
--help Shows help for the `mx convert`` command and exits.
--in-place -p Converts the current app directory. Use this option to convert a folder containing a Mendix app. Otherwise, mx convert will convert .mpk files.
--skip-error-check -s Does not check for errors. Use this option to disable app error-checking during the conversion. When omitted, the tool will report on the number of errors, warnings, and deprecations in the app and do the conversion.

For INPUT..., enter one or more .mpk files or one directory that needs to be converted.

For OUTPUT, enter the output location for the converted results. Please note the following:

  • When INPUT... is a single file, OUTPUT can be a single file or directory; otherwise, OUTPUT must be a directory
  • When using the --in-place option, the INPUT... folder will also be used as the OUTPUT folder, so you do not need to specify a separate OUTPUT folder

Examples

These are example commands:

Example Result
mx convert --in-place C:\MxProjects\App-main Converts the app in folder C:\MxProjects\App-main to the specific Studio Pro version that the mx tool is bundled with.
mx convert C:\Mendix\App1.mpk C:\Mendix\App2.mpk C:\Mendix\ConvertedProjects\ Converts the App1.mpk and App2.mpk app packages that are in the C:\Mendix\ folder and puts the results in the C:\Mendix\ConvertedProjects\ folder.
mx convert --skip-error-check C:\Mendix\Packages\ C:\Mendix\ConvertedPackages\ Converts all the app packages in the C:\Mendix\Packages\ folder to the C:\Mendix\ConvertedPackages\ folder without checking for errors.

Return Codes

These are the return codes:

Return Code Description
0 The conversion was successful.
1 An internal error occurred.
2 There is something wrong with the command-line options.
3 Converting failed.

mx check Command

The mx check command checks the app .mpr file for issues such as errors, warnings, deprecations, or performance recommendations.

Usage

Use the following command pattern for mx check:

mx check [OPTIONS] INPUT [Optional path to exported Suppress Warnings file (JSON)]

These are the OPTIONS:

Option Shortcut Result
--help Shows help for the mx check command and exits.
--warnings -w Includes warnings in the output.
--deprecations -d Includes deprecations in the output.
--performance -p Includes performance checks in the output (performance recommendations are only outputted if there are no errors).

For INPUT, enter a single .mpr file.

You can optionally specify the path to an exported suppress-warnings (JSON) file. This means mx check -w will use the list of suppressed warnings in the JSON file, instead of the default behavior (which is to read from the project-settings.user.json file in the app directory).

Examples

These are example commands:

Example Result
mx check --help Displays the help text for the check command.
mx check C:\MxProjects\App-main\App-main.mpr Checks the app at C:\MxProjects\App-main\App-main.mpr for errors.
mx check C:\MxProjects\App-main\App-main.mpr -p Checks the app at C:\MxProjects\App-main\App-main.mpr for errors and performance recommendations.
mx check C:\MxProjects\App-main\App-main.mpr --warnings --deprecations Checks the app at C:\MxProjects\App-main\App-main.mpr for errors, warnings, and deprecations. Suppressed warnings will be read from the project-settings.user.json file within the app directory.
mx check C:\MxProjects\App-main\App-main.mpr c:\MxFiles\my-exported-suppressed-warnings.json --warnings Checks the app at C:\MxProjects\App-main\App-main.mpr for errors and warnings. Suppressed warnings will be read from the JSON file my-exported-suppressed-warnings.json.
mx check C:\MxProjects\App-main\App-main.mpr -w -d -p Checks the app at C:\MxProjects\App-main\App-main.mpr for errors, warnings, deprecations, and performance recommendations.

Return Codes

These are the return codes:

Return Code Description
0 No issues found.
1 Errors were found.
2 Warnings were found.
4 Deprecations were found.
8 Performance recommendations were found.

Those values are logically OR combined to indicate when there are a mix of errors, warnings, deprecations, or performance recommendations.

For example:

  • 3 if errors and warnings found
  • 7 if errors, warnings, and deprecations found

mx translate Command

The mx translate command allows you to export and import all translatable texts included in your Mendix application. This command is currently in public beta.

Usage

Use the following command pattern for mx translate:

mx translate [-i|-e] -t EXPORT_FORMAT -s LANGUAGE_CODE PROJECT TRANSLATION_PATH [OPTIONS]

These are the required parameters:

Option Shortcut Result
--import-translations -i Imports the translations from the directory specified as the translation directory. This is required if export is not specified.
--export-translations -e Exports the translations from the directory specified as the translation directory. This is required if import is not specified.
--type -t Specifies the file type to use. This can be either xlsx or po.
--source-language-code -s Specifies the ISO 639 language code to use (for example,en_US as the source language to translate from). This will be used as the text that needs to be translated.

For PROJECT, enter a single .mpr file. For TRANSLATION_PATH, enter a filepath to import or export the translation files from.

These are the OPTIONS:

Option Shortcut Result
--force-import -f Accepts some warnings and errors and tries to continue the import process.
--loose-version-check -l Converts the project to the version of the mx.exe, if it is a different version.

Examples

These are example commands:

Example Result
mx translate --help Displays the help text for the translate command.
mx translate -i -t po -s en_US C:\MxProjects\App-main\App-main.mpr C:\MxProjects\App-main\translations Imports .po files from C:\MxProjects\App-main\translations in to the app at C:\MxProjects\App-main\App-main.mpr with en_US as the source language code.
mx translate -e -t xlsx -s en_US C:\MxProjects\App-main\App-main.mpr C:\MxProjects\App-main\translations Exports .xlsx files from the app at C:\MxProjects\App-main\App-main.mpr in to the directory at C:\MxProjects\App-main\translations with en_US as the source language code.

Return Codes

These are the return codes:

Return Code Description
0 No issues found.
100 Validation error on the input.
300 Exception, something went wrong.