Java version compatibility when creating an own add-on

We are about to create multiple Jmix projects using common features. To keep us able to maintain them and avoid duplicating code, we want to create Jmix add-ons sharing these common features.

I have read the topic https://forum.jmix.io/t/multi-module-application/362. I am aware, that there is no full studio-support yet for creating screens, entities etc. So We started to create an add-on without the studio having a look at the ldap add-on. We managed to create a basic directory structure and gradle configurations.

The code we want to move into the new add-on is already existing in two Jmix application projects. But declaring the dependencies which are required for the feature fails when trying to compile the code as add-on. The dependencies contain company-internal libraries as well which are compiled with Java 11.

Unfortunately the jmix build for add-ons forces the Java version compatibility to Java version 8:
Method private void setupCompilation(Project project, JmixBuildExtension extension) in https://github.com/Haulmont/jmix-build/blob/v1.1.0/src/main/groovy/io/jmix/build/JmixBuildPlugin.groovy.

I understand, that public add-ons should fulfill this requirement, but I wasn’t able to modify this for our internal add-ons.

Is there any way?

1 Like

I wouldn’t recommend using jmix-build plugin in applications. It’s an internal tool and may be changed at any time breaking your build. If you really want to replicate the Jmix modules build structure, better create your own plugin by copying everything relevant from jmix-build.

In general, we now consider the problem of sharing application logic in the form of add-ons as a priority for implementing in Studio.

A possible structure for composite projects for developing add-ons together with applications is demonstrated here: https://github.com/jmix-projects/sample-composite-project.
It’s very simple, doesn’t require modifications of build scripts, and allows developing of subprojects both totgether and separately. Maybe it’s a suitable structure for your goal. If you have any comments on this - please let us know.

Regards,
Konstantin

2 Likes

@krivopustov Thank you for your reply.

Maybe I didn’t express myself good. I don’t want to use the jmix-build in an application. In the current phase I want to create an add-on only, to use it in different of our applications.

My approach was having a look at the source code of the ldap-add-on and tried to create our add-on in that way.

I’m aware, using internal tools directly may break something in the future - but I just have no better approach yet.

I will have a look to the composite sample. Thank you.

Then just use the “Single Module Add-on” project template in the new project wizard.

1 Like

@krivopustov

I’m sorry for responding late. That’s the most obvious solution. I must have missed the introduction of this wizard, sorry.