Multiple Applications / Components and the WildFly Maven Plugin

109 views
Skip to first unread message

Torsten Liermann

unread,
Aug 20, 2024, 3:53:30 PM8/20/24
to WildFly

Hello!

It seems to me that the WildFly Maven plugin doesn't allow building a JBoss as a bootable JAR or Docker image for multiple applications that need to run in a JBoss container.

Currently, I'm working around this by explicitly invoking Glow and Galleon from within Maven. With Glow, you can specify multiple artifacts, but unfortunately, this isn't possible with the WildFly Maven plugin. What is the deeper reasoning behind this limitation?

Or am I missing something, and it actually works?

Thanks!

Best regards,
Torsten

James Perkins

unread,
Aug 22, 2024, 10:44:44 AM8/22/24
to WildFly
Hello,
Can you explain a bit more what you're attempting to do? Do you have multiple Maven modules which you need different bootable JAR's for or are you attempting to create multiple bootable JAR's from a single Maven module?

Torsten Liermann

unread,
Aug 23, 2024, 2:25:53 AM8/23/24
to WildFly
My application is modularized in such a way that multiple EARs or WARs are built through a Maven multi-module project—this corresponds to the idea of a modular monolith. At the end of the build, these EARs should be bundled with the WildFly server into a single image using the WildFly Maven plugin. It seems to me that this isn't possible with the WildFly Maven plugin because only one archive can be specified using `<filename>`.

At the moment, my workaround involves calling Glow and Galleon via CLI. For the sake of completeness, here is an excerpt from the last build step:

<plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>3.4.1</version>
                        <configuration>
                            <skip>false</skip>
                        </configuration>
                        <executions>
                            <execution>
                                <id>run-glow</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>java</executable>
                                    <arguments>
                                        <argument>-jar</argument>
                                        <argument>${org.wildfly.glow:wildfly-glow:jar}</argument>
                                        <argument>scan</argument>
                                        <argument>../ear-1/target/ear-1-${project.version}.ear</argument>
                                        <argument>../ear-2/target/ear-2-${project.version}.ear</argument>

                                        <argument>--provision=PROVISIONING_XML</argument>
                                        <argument>--output-dir=${project.build.directory}</argument>
                                        <argument>--suggest</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                            <execution>
                                <id>run-galleon</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>java</executable>
                                    <arguments>
                                        <argument>--add-modules=java.se</argument>
                                        <argument>
                                            -Dlogging.configuration=file:${project.basedir}/src/galleon/galleon-cli-logging.properties
                                        </argument>
                                        <argument>-jar</argument>
                                        <argument>${org.jboss.galleon:galleon-cli:jar}</argument>
                                        <argument>provision</argument>
                                        <argument>${project.build.directory}/provisioning.xml</argument>
                                        <argument>--dir=${project.build.directory}/server</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

James Perkins

unread,
Aug 26, 2024, 4:48:05 PM8/26/24
to WildFly
What you would need to do is define properties and/or configurations for each EAR in the EAR's pom.xml. If the example is in some kind of final Maven module, then that would work as well by defining the configuration for the wildfly-maven-plugin in different executions. That's how it would work for any Maven plugin really.

If you've got a more complete example with the wildfly-maven-plugin, I might be able to give a more concrete suggestion.

Torsten Liermann

unread,
Aug 27, 2024, 4:36:18 PM8/27/24
to WildFly
I have an example on GitHub accessible via this URL https://github.com/torsten-liermann/wildfly-multiapps . Please check the `provisioning/pom.xml`. I’ve also included the initially mentioned workaround there. So, this is the question I’m facing:
  How can a modularized monolith, consisting of multiple EARs and/or WARs, obtain an optimized Wildfly server using the wildfly-maven-plugin, thanks to Glow and Galleon?

Thank you for your effort!  

Torsten Liermann

unread,
Sep 3, 2024, 10:10:55 AM9/3/24
to WildFly
Here’s the continuation: https://issues.redhat.com/browse/WFMP-269. Thanks, Jean F.!
Reply all
Reply to author
Forward
0 new messages