Search code examples
configurationyamlprogram-entry-pointwildfly-swarm

How to configure custom main class using YAML in wildfly swarm application


I am trying to build a Wildfly Swarm application using custom main class specified in plugin configuration ( as shown below )

<plugin>
    <groupId>org.wildfly.swarm</groupId>
    <artifactId>wildfly-swarm-plugin</artifactId>
    <version>2018.3.3</version>
    <configuration>
        <mainClass>rnd.web.service.rest.App</mainClass>
    </configuration>
</plugin>

But during build/run is show deprecation warning/information (see below) with reference to documentation. But the documentation does not provide any details on how to implement it.

Custom main() usage is intended to be deprecated in a future release and is no longer supported, please refer to http://docs.wildfly-swarm.io for YAML configuration that replaces it.

If someone has encountered and implemented it. Please share the approach and correct reference.


Solution

  • As the deprecation warning says, it's not the <mainClass> setting that's deprecated, it's the entire usage of custom main method. All the configuration you do in your main method, you should be able to do with the YAML configuration. If you find something missing, then that's a bug.