How to Auto-deploy with Jboss

automationjboss

How to automatically deploy a project with jboss as 7. Is there a way to automatically deploy a Project using the Jboss-cli.sh in Jboss as 7?

Best Answer

I was searching the Internet for this answer and could not find it. I recently figured it out and thought I would share. I wrote a linux shell script that works perfectly. Taking the time to deploy while developing from 2-3 minutes to 10 seconds which makes programming so much faster. Here is my script:

 #!/bin/bash

cd /home/samo/EAP*/bin
./jboss-cli.sh --connect <<EOF
undeploy FlcErp.ear
deploy /home/samo/NetBeansProjects/FlcErp/FlcErp/dist/FlcErp.ear
EOF

first line of the script navigates to the location of your server bin. the second line opens jboss-cli.sh and connects to the instance. everything after <<EOF and before EOF are commands you can send to the jboss-cli.sh program. In this case I undeploy my current instance which is FlcErp.ear then I deploy the full location of my project.

You then save this file the file with your desired name "Deploy" change the permission with chmod 755 Deploy

Then add this file to your path with: export $PATH = $PATH:/home/samo/bin

to execute file just type filename into terminal

Related Topic