Mx 10: Dependency management the transition

Mitchel Mol
|
October 18, 2024

Java dependency management has been a struggle in Mendix projects for a long time. Especially when you had no idea they existed in the first place. Sure, you might have imported a module or two from the Marketplace, and you might have even seen information about having to remove a userlib Java JAR, but most users have no idea.

With Mendix 10, Managed Dependencies have been introduced. This allows module developers to specify the Java libraries required to use the module.

Instead of placing these modules in the userlib folder, they are placed in the vendorlib folder. On top of that, a nice vendorlib-sbom.json file is created based on the dependencies specified.

vendorlib folder of a Mendix Project

“Mendix Studio Pro allows you to manage your Java dependencies. By specifying Java dependencies and their versions per module, Studio Pro can automatically download them and resolve conflicts by leveraging Gradle.”

This makes upgrading modules much easier. Instead of cleaning up any old Java libraries during an upgrade, Studio Pro will take care of them.

Adding a new dependency in your module settings

Once the dependencies are specified, they are automatically downloaded from Maven and Gradle repositories. If needed, you may specify custom repositories yourself in the Studio Pro settings.

Custom repository settings

Adding exclusions

Different versions of the same library or even libraries with the same classpath/-names could cause conflicts. For this particular reason, libraries may be specified with exclusions. This will ensure proper compilation and execution of every module.

Java Dependency exclusions

Migrating from userlib to vendorlib

When you upgrade your project from Mendix 9 to 10, you must update your modules to be compatible again. Most, if not all, platform-supported modules support the new dependency management (vendorlib), and even community-supported modules are gaining support. This means your upgrade to Mendix 10 will hopefully be the last time you must clean out the userlib folder.

I suggest moving all the existing files into a separate folder, and when the userlib folder is empty, start updating the modules. This should take care of most, if not all, dependencies getting imported via the new dependency management functionality.

The remaining dependencies will be those in your Java code. Use Sonatype’s Maven repository to look up the missing dependencies and add them to your module settings.

Example Maven dependency

Create order with managed dependencies

The managed dependencies will save many Mendix developers the headaches of managing the userlib folder mess that usually accumulates over time. It will also save module builders a lot of instructions for those developers who need to clean up older versions of the libraries included in the modules they build.

This is an excellent step in the area of developer experience improvements.

If you have any questions or need help with the transition, message us!

Mendix Meetup 30 October

Join our Halloween themed Mendix Meetup
RSVP Now!
By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View our Privacy Policy for more information.

Heading

What’s a Rich Text element?

The rich text element allows you to create and format headings, paragraphs, blockquotes, images, and video all in one place instead of having to add and format them individually. Just double-click and easily create content.

Static and dynamic content editing

A rich text element can be used with static or dynamic content. For static content, just drop it into any page and begin editing. For dynamic content, add a rich text field to any collection and then connect a rich text element to that field in the settings panel. Voila!

How to customize formatting for each rich text

Headings, paragraphs, blockquotes, figures, images, and figure captions can all be styled after a class is added to the rich text element using the "When inside of" nested selector system.

Mendix Meetup 30 October

Join our Halloween themed Mendix Meetup
RSVP Now!
By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View our Privacy Policy for more information.