Groovy in Forge

imagine if we could submit .groovy script files inside our Forge app that automagically (with help from Forge platform) gets compiled as as plugin to the backing server instance, and can actually execute code, and I think that would allow developers to build custom REST endpoints, but routed from the Java process to say, Forge, connect, …generally.

The reason why I think something like this is possible, is because in Manage Apps section I se P2 plugins listed. I don’t know why they are there, we can’t do nothin’ with 'em, and there are days when I think things would be simpler if I could upload one as well, so …

A simplistic Java plugin can be built that builds the plugin archive with provided .groovy files for each Forge app providing this module, and from thereafter it’s just another plugin; so there would be the head plugin, which receives these files and builds other plugins, and many smaller head-built plugins.

The syntax would allow for something similar known to many, a groovy script dependency injected with entity services. Generally, many of REST endpoints I’ve built in P2 framework were short calls to the Java API, with short execution times - like GET requests for the plentiful entities in Jira, but not always having a REST interface. However, what you would like to is wrap the execution of these scripts in some kind of wrapper runner to enforece short execution time and prevent application hang-up, as you would most likely want to avoid taking up too much time.

Now, with security, as you know, a generalized idea can be built around this akin to current Forge scopes, or just dependency inject components by name, provided an internal list lists it as well and let developers request services through a ticket to be added to that list, or group components in predefined scopes.

That is of course assuming Cloud is actually running with “on-premise” application running it in the background, or that Atlassian doesn’t have a more cloud-sided solution for this already in the works…

Anyway, let me know what you think of this idea. Do you have a need for such a feature? What would you be able get from Jira that you otherwise aren’t able to with Cloud REST API. I for instance would love to see an endpoint that lists installed plugins, modules and their icons and say page URLs (like a Project Page module link).

For me personally, this opens a door to a new Forge plugin idea I’ve had for a while and has to do with onboarding and pointing users to various apps’ page’s, step by step. Indirectly, this could also allow for the { router } from '@forge/bridge to navigate seamlessly to those pages, which would make for an interesting feature in a plugin.

Thanks for the read.