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.
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: GitHub - jmix-projects/sample-composite-project · GitHub.
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.
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.