How to use Jmix in a Maven project in Eclipse

After four days and nights, I managed to build and run a Jmix application in Eclipse with Maven.

During the Gradle build in IntelliJ, several enhancement steps are executed by the Jmix Gradle plugin.
Since there is no Maven plugin, it is impossible to execute these necessary steps directly from Maven.

However, I found the following solution:
You can copy the IntelliJ project files directly into the Eclipse Maven project’s source folder.
Then, copy the pom.xml file that I have attached here.

The pom.xml file defines the Maven build/run process, which works like this:

Let Maven build its Java classes using the specified Jmix dependencies.
The build then calls the Gradle build, which generates the enhanced classes and resources.
Maven then copies the enhanced files to the Maven output directory, replacing the unenhanced files.
Maven then finishes the build process and starts the Spring Boot application.

The next step would be that the maven build automatically copies the src files from the IntelliJ Jmix Project directory to the maven project directory in Eclipse.

This proves the concept of incorporating Jmix functionality into a preexisting Java Maven project.

Of course, you can also add the pom.xml to the IntelliJ Jmix project directory, import the directory into Eclipse, and run the Maven build.
This is easier, but there is little reason to do so because it only makes sense to build and run on the Eclipse side if you have to integrate with other parts that cannot run in IntelliJ or if it would be a lot of work to migrate the existing build scripts from Maven to Gradle.

Greetings from Switzerland
Peter Henzler
pom.xml (13.3 KB)

2 Likes