Wednesday, 3 October 2018

MAVEN: TO RESTART THE SERVER IN OUR CASE JBOSS THROUGH MAVEN

Normally org.wildfly.plugins provide wildfly-maven-plugin with some basic preinstalled commands that can be run direcly through maven scripts such as deploy,redeploy, run, start, shutdown etc. (For more see docs.jboss.org/wildfly/plugins/maven/latest/plugin-info.html). What I want to accomplish is to restart the jboss application server by running one command the fun part is the server is located somewhere else.

However, first hurdle was to ensure either we can restart the server, for this, i put aside the externel server thing for later and tried to restart the local one. As one can see the Shutdown has an optional parameter for reload, what more i have used is jboss-home because when i was trying to start the server it was using the server that was reside in my deployed project war some other location that i do not want to use.

Therefore, i provided the particular JBOSS directory in the configuration along with the shutdown parameter to let the wildfly knows i want to restart the server not shutdown. Following is the code that i have used:

<plugin>
<groupId>or.wildfly.plugin</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.2.1.Final</version>
<configuration>
<jboss-home>C:/.../jboss-eap-7.0</jboss-home>
<reload>true</reload>
<hostname>127.0.0.1</hostname>
</configuration>
</plugin>

The above code helped to restart my local server with the wildfly:shutdown command.


No comments:

Post a Comment