Issue
When attempting to create a deployment package using the MxBuild tool, the following error occurs:
ERROR: An error occurred while compiling Java actions
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compile'.
> error: release version 21 not supported
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 7sEnvironment
Studio Pro (all versions)
Cause
The issue is caused by a mismatch between the Java version specified in the App Settings and the Java Development Kit (JDK) specified in the MxBuild command. For example, the error occurs if Java 11 is specified in the application settings and Java 21 is specified in the MxBuild command:
mxbuild --java-home="C:\Program Files\Eclipse Adoptium\jdk-11.0.20.101-hotspot" --java-exe-path="C:\Program Files\Eclipse Adoptium\jdk-21.0.2.13-hotspot\bin\java.exe" "C:\application.mpr"The issue can also occur due to the presence of a java-version file in the root of the project, with the content 11. This file overrides the Java version setting in the project, causing a conflict with the required Java 21 version for Mendix 10 projects.
Solution / Workaround
To resolve the problem, ensure that the Java version specified in the App Settings and the Java version specified in the MxBuild command are the same. For example, if Java 11 is specified in the App Settings, ensure that Java 11 is specified in the MxBuild command:
mxbuild --java-home="C:\Program Files\Eclipse Adoptium\jdk-11.0.20.101-hotspot" --java-exe-path="C:\Program Files\Eclipse Adoptium\jdk-11.0.20.101-hotspot\bin\java.exe" "C:\application.mpr"If the issue is caused by the java-version file, delete the file to resolve the issue.
Internal information related
- 222324, 261332
- DEPS-740
Additional information
- Mendix documentation:
- Other documentation: Java Development Kit (JDK)
0 Comments