Add guide on adding custom Java function library#543
Open
Conversation
This guide / use case is based on a question and subsequent solution provided in the public mailing list: https://lists.evolveum.com/pipermail/midpoint/2026-January/008670.html
licehammer
requested changes
Apr 7, 2026
Contributor
licehammer
left a comment
There was a problem hiding this comment.
You can expect the person reading this is a java programmer.
| :page-description: Package Java classes to JAR files to use them as custom functions in midPoint expression scripts | ||
|
|
||
| MidPoint makes compiled Java classes available to all script expressions similarly to functions in expression function libraries. | ||
| Methods of public classes packaged in JAR files and placed in midPoint home directory are accessible in expressions using their fully qualified class name. |
Contributor
There was a problem hiding this comment.
Technically it can be placed anywhere on classpath (which includes MIDPOINT_HOME/lib). You can then address using fully qualified class name or use java import mechanism.
| Requirements and constraints: | ||
|
|
||
| * Classes must be `public`. | ||
| * Methods called from expression scripts must be `public static`. |
Contributor
There was a problem hiding this comment.
It should work even with non-static methods, but you would have to instantiate the class first which is an overkill for most scripts.
| * Classes must be `public`. | ||
| * Methods called from expression scripts must be `public static`. | ||
| * The class and its dependencies must be compatible with the JVM version midPoint runs on. | ||
| * Do not use package or class names that would collide with those already used by midPoint. |
Contributor
There was a problem hiding this comment.
You can use colliding class names. That's why Java have packages.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This guide / use case is based on a question and subsequent solution provided in the public mailing list: https://lists.evolveum.com/pipermail/midpoint/2026-January/008670.html
I humbly ask for a fact-check / review of the article from someone on the eng (or dev) team. Thank you.