Custom WildFly distributions using Channels

The WildFly Channels project allows for provisioning custom component versions in a WildFly distribution. In this article, we will learn how to configure a custom WildFly distribution that contains a RestEasy module not yet available in the latest version of the application server.

By customizing its installation, WildFly allows you to create a distribution with only the modules your application requires. One of the most common ways to achieve this is to combine different layers. Behind the scenes, the Galleon tool is your swiss army knife for provisioning custom distributions. With the recent addition of WildFly Glow, which automatically detects the layers you need, this process is now even easier. This article covers WildFly Glow in more detail: WildFly Glow: Next-Gen Evolution in Provisioning

On the other hand, if you want to update a single module version (e.g., Hibernate or RestEasy), one of the most common approaches is to manually (or with the CLI) modify the modules structure of the application server.

By using WildFly Channels, you can now define component versions you need to provision WildFly, overriding the default WildFly’s feature packs. To make this process easier, WildFly is now publishing channel manifests as part of each release.

Technically, a Channel combines a Manifest defining content of channel, one or more Repositories from which you can fetch content and an optional Blocklist Manifest.

You can define both channels and manifests in the YAML language with a corresponding JSON schema to validate its structure.

For example, here you can have a look at a WildFly Manifest definition available in the repository of WildFly Channel: https://github.com/wildfly-extras/wildfly-channel/blob/main/core/src/main/resources/org/wildfly/manifest/v1.0.0/schema.json

You can find more details about the definition of the core elements of WildFly Channels in the GitHub repository where the source code is available: https://github.com/wildfly-extras/wildfly-channel

In this article, we will now show how to provision a WildFly distribution with a custom RestEasy component.

Creating a custom WildFly distribution

Recently, the Reasteasy 6.2.9.Final and 7.0.0.Alpha2 versions have been published. We will show how to provision a WildFly custom distribution which uses the version 7.0.0.Alpha2. This version is Jakarta RESTful Web Services 4.0 compliant.

Firstly, create a Jakarta EE 10 project with Maven. For example, you can bootstrap a WildFly project with:

mvn archetype:generate \
    -DarchetypeGroupId=org.wildfly.archetype \
    -DarchetypeArtifactId=wildfly-getting-started-archetype

Then, in the plugins section, add the wildfly-maven-plugin with the following configuration:

<plugin>
    <groupId>org.wildfly.plugins</groupId>
    <artifactId>wildfly-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>server-provisioning</id>
            <phase>generate-test-resources</phase>
            <goals>
                <goal>provision</goal>
            </goals>
            <configuration>
                <feature-packs>
                    <feature-pack>
                        <groupId>org.wildfly</groupId>
                        <artifactId>wildfly-preview-galleon-pack</artifactId>
                    </feature-pack>
                </feature-packs>
                <channels>
                    <channel>
                        <manifest>
                            <groupId>org.wildfly.channels</groupId>
                            <artifactId>wildfly-preview</artifactId>
                        </manifest>
                    </channel>
                    <channel>
                        <manifest>
                            <groupId>dev.resteasy.channels</groupId>
                            <artifactId>resteasy-7.0</artifactId>
                        </manifest>
                    </channel>
                </channels>
            </configuration>
        </execution>
    </executions>
</plugin> 

Notice the addition of the dev.resteasy.channels:resteasy-7.0 which allows provisioning the latest version of Reasteasy.

Then, build your project as usual with:

mvn install

Within the target/server folder you will find a WildFly distribution which has been provisioned by Galleon.

Then, start WildFly and check that RestEasy version 7.0.0.Alpha is available:

wildfly resteasy 7 with wildfly channels

That’s all! We can now experiment new Jakarta RESTful Web Services 4.0 features with WildFly!

Conclusion

This article was a walk-through the WildFly Channel project and how you can use it to create custom WildFly installations by including the appropriate Channels in your WildFly Maven plugin. Stay tuned for more articles on RestEasy 7 and WildFly !