Introduction
Conflicting JAR files in the userlib folder of an app directory can cause Java errors when running the app:
Compilation of Java actions failedRemoving duplicate JAR files from the userlib folder will resolve these errors. This article will describe how this can be accomplished.
Note: Mendix introduced Managed Dependencies in Studio Pro 10.3.0, which allows Studio Pro to automatically download dependencies and resolve conflicts by leveraging Gradle, and stores them in the vendorlib folder. Using this feature will eliminate the need to find and remove duplicate JAR files, thus it is advised to migrate to Managed Dependencies by following the Migrating from Unmanaged to Managed Dependencies, to prevent these issues from occurring in the first place.
Environment
Studio Pro (all versions)
Instructions/Procedure
Duplicate JAR files can be removed manually by checking the userlib folder of a project in the app directory (can be accessed via Studio Pro by navigating to App > Show App Directory in Explorer). Alternatively, this can be done by using the third-party Mendix Userlib Cleaner tool developed by Cinaq, as described below:
- Download the corresponding build from the releases folder
-
Unzip the
mendix-userlib-cleaner.exeinto the userlib folder of the app directory. -
In the Explorer window, click on the path, type
cmdand press enter. -
This opens a black terminal window. In this terminal window, use the following command:
.\mendix-userlib-cleaner.exe.
The output will inform you what it will remove. -
Verify the output. Thereafter, to actually remove the JAR files, use the following command:
.\mendix-userlib-cleaner.exe --clean
Note that this tool will only check for libraries. If there is anything else in the folder that is not a JAR file or a .Required extension, then it should not be in the userlib folder and can be deleted.
It is also recommended to clean the deployment directory of the app after performing the above steps before attempting to run the app again. This can be done by navigating to App > Clean Deployment Directory in Studio Pro.
Outcome
The userlib folder will be cleaned and will no longer contain conflicting JAR files.
Internal information related
- 256293, 251126, 195623, 240133, 201110, 253589
Additional information
- Mendix documentation: Managed Dependencies
- Other documentation: Mendix Userlib Cleaner
0 Comments