Wildfly has administrative REST support. No need for fancy tools.
Here is a BASH script for Wildfly and Glassfish auto-redeploy of Maven projects, ie. when working with auto-compile in Eclipse:
set -x
pubname=$1
usewar=$2
if [[ -z $pubname ]]; then
pubname=ROOT
fi
if [[ -z "$usewar" ]]; then
usewar=0
else
usewar=1
fi
if ! webappdir=$(ls -d `pwd`/target/*-SNAPSHOT); then
webappdir=$(pwd)
fi
iswildfly=0
ctxroot="/$pubname"
if [[ "$pubname" == "ROOT" ]]; then
ctxroot="/"
fi
port=4848
if curl http://localhost:9991/ ; then
port=9991
iswildfly=1
elif curl http://localhost:9990/ ; then
port=9990
iswildfly=1
fi
if (( usewar )); then
webappdir=$webappdir.war
if ! (( iswildfly )); then
webappdir="@"$webappdir
fi
fi
wildflycmd() {
local cmd=$1
curl --retry 100 --retry-delay 3 --retry-connrefused --digest -L -u admin:admin -D - http://localhost:$port/management \
--header "Content-Type: application/json" \
-d "$cmd"
}
if (( iswildfly )); then
wildflycmd '{"operation" : "composite", "address" : [], "steps" : [{"operation" : "undeploy", "address" : {"deployment" : "'$pubname'.war"}},{"operation" : "remove", "address" : {"deployment" : "'$pubname'.war"}}],"json.pretty":1}'
if (( usewar )); then
wildflycmd '{"operation" : "composite", "address" : [], "steps" : [{"operation" : "add", "address" : {"deployment" : "'$pubname'.war"}, "content" : [{"url" : "file:'$webappdir'"}]},{"operation" : "deploy", "address" : {"deployment" : "'$pubname'.war"}}],"json.pretty":1}'
else
wildflycmd '{"operation" : "composite", "address" : [], "steps" : [{"operation" : "add", "address" : {"deployment" : "'$pubname'.war"}, "content" : [{"path" : "'$webappdir'", "archive":"false"}]},{"operation" : "deploy", "address" : {"deployment" : "'$pubname'.war"}}],"json.pretty":1}'
fi
fi
inotifyEvents=""
if ! [[ "$(uname)" =~ ^CYGWIN ]]; then
inotifyEvents="-e close_write"
fi
while inotifywait $inotifyEvents -r $webappdir --excludei "\.(js|html|css)$" || :; do
if ! (( iswildfly )); then
curl -v -H 'Accept: application/json' \
-X POST \
-H 'X-Requested-By: loadr' \
-F force=true \
-F id=$webappdir \
-F isredeploy=true \
-F virtualservers=server \
-F contextRoot=$ctxroot \
-F name=$pubname \
http://localhost:$port/management/domain/applications/application
else
wildflycmd '{"operation" : "composite", "address" : [], "steps" : [{"operation" : "redeploy", "address" : {"deployment" : "'$pubname'.war"}}],"json.pretty":1}'
fi
done
Just start the Wildfly instance with mvn clean wildfly:run
.
Source: https://github.com/jjYBdx4IL/snippets/blob/master/java/jee_autodeploy.sh