How to Use Jenkins to remotely deploy to Glassfish/Payara server

1. Use "asadmin login --host remoteHost --port remotePort" to save your glassfish admin login. Just run this multiple times if you want to deploy to multiple different Glassfish servers.

2. Copy the glassfish admin login file from ~/.asadminpass (or ~/.gfclient/pass) to the home folder of the user who runs jenkins. For example, if you run Jenkins as a service in Centos/Fedora/RedHat, then copy ~/.asadminpass to /var/lib/jenkins (or ~/.gfclient/pass). You don't need to copy if you run step 1 directly from the user.
$ sudo cp ~/.asadminpass /var/lib/jenkins/
$ sudo chown jenkins:jenkins /var/lib/jenkins/.asadminpass
3. Create a free-form project and fill in the information similar to the information below:
/usr/local/glassfish/bin/asadmin --host beta --port 4848 --name ca-i88 /temp/ca-i88-1.0-SNAPSH.ear
# or
/usr/local/glassfish/bin/asadmin --virtualservers beta --contextroot /online/tasks --host beta --port 4848 --name ca-i88 /temp/ca-i88-1.0-SNAPSH.ear

Featured Post

When you copy an AWS EC2 snapshot, you can choose to encrypt the copy

Encrypted Snapshots When you copy a snapshot, you can choose to encrypt the copy (if the original snapshot was not encrypted) or you can s...