DEPLOY AN APPLICATION TO JBOSS WITH MAVEN

  1. sudo apt install maven

  2. git clone https://github.com/jboss-developer/jboss-eap-quickstarts.git

  3. edit pom.xml for ~/jboss-eap-quickstarts/helloworld project
    cd ~/jboss-eap-quickstarts/helloworld
    add below lines into pom.xml:

    <build>
     <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
      <plugins>
            <plugin>
                <groupId>org.wildfly.plugins</groupId>
                <artifactId>wildfly-maven-plugin</artifactId>
                <version>2.1.0.Beta1</version>
                <configuration>
                    <hostname>localhost</hostname>
                    <port>9990</port>
                    <username>admin</username>
                    <password>pas8word@</password>
                </configuration>
            </plugin>
      </plugins>
     </pluginManagement>
    </build>
  4. run mvn package to generate helloworld.war

  5. mvn wildfly:deploy
    (mvn wildfly:undeploy to undeploy it)
    ….
    [INFO] — wildfly-maven-plugin:2.1.0.Beta1:deploy (default-cli) @ helloworld —
    [INFO] JBoss Threads version 2.3.3.Final
    [INFO] JBoss Remoting version 5.0.12.Final
    [INFO] XNIO version 3.7.2.Final
    [INFO] XNIO NIO Implementation Version 3.7.2.Final
    [INFO] ELY00001: WildFly Elytron version 1.9.1.Final
    [INFO] ————————————————————————
    [INFO] BUILD SUCCESS
    [INFO] ————————————————————————
    [INFO] Total time: 23.553 s
    [INFO] Finished at: 2020-06-26T09:51:01-04:00
    [INFO] ————————————————————————
    you can verify from your jboss console
    http://192.168.0.43:9990/console/index.html, the app has been deployed.
    or you can open helloworld app directly:
    http://192.168.0.43:8090/helloworld/HelloWorld

    check full package in https://github.com/zhuby1973/python/tree/master/maven_jboss

you can also create a freestyle job AutoDeployTest in Jenkins:
choose exec shell in Build:
cd /tmp/jboss-eap-quickstarts/helloworld
mvn wildfly:undeploy
mvn wildfly:deploy

REF:
https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
https://github.com/jboss-developer/jboss-eap-quickstarts.git
https://github.com/jbossas/jboss-as-maven-plugin.git

Install and Configure WildFly (JBoss7) App Server on Ubuntu 20.04

Step 1: Install OpenJDK
sudo apt install openjdk-8-jdk
Step 2: Setup WildFly User
sudo groupadd -r wildfly
sudo useradd -r -g wildfly -d /opt/wildfly -s /sbin/nologin wildfly
Step 3: Download and Configure WildFly
cd /tmp
wget https://download.jboss.org/wildfly/20.0.0.Final/wildfly-20.0.0.Final.tar.gz
tar xvf wildfly-20.0.0.Final.tar.gz
sudo mkdir /opt/wildfly
sudo mv wildfly-20.0.0.Final/ /opt/wildfly
sudo chown -RH wildfly: /opt/wildfly
Step 4: create WildFly service
sudo mkdir -p /etc/wildfly
sudo cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.conf /etc/wildfly/
sudo cp /opt/wildfly/docs/contrib/scripts/systemd/launch.sh /opt/wildfly/bin/
sudo sh -c ‘chmod +x /opt/wildfly/bin/
.sh’
sudo cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.service /etc/systemd/system/
sudo systemctl enable wildfly.service
sudo systemctl stop/start/status wildfly.service
undefined
run the commands below to create a user account that will connect and manage the app server web console:
sudo /opt/wildfly/bin/add-user.sh

step 5: enable admin console remote login
Out of the box, the server console is restricted to the local server only… If you’d like to connect from a remote location, Open it’s configuration file by running the commands below:
edit /etc/wildfly/wildfly.conf as below:

# The configuration you want to run
WILDFLY_CONFIG=standalone.xml
# The mode you want to run
WILDFLY_MODE=standalone
# The address to bind to
WILDFLY_BIND=0.0.0.0
#WildFly Console bind 
WILDFLY_CONSOLE_BIND=0.0.0.0

edit /opt/wildfly/bin/launch.sh as below:

#!/bin/bash
if [ "x$WILDFLY_HOME" = "x" ]; then
    WILDFLY_HOME="/opt/wildfly"
fi
if [[ "$1" == "domain" ]]; then
    $WILDFLY_HOME/bin/domain.sh -c $2 -b $3 -bmanagement $4
else
    $WILDFLY_HOME/bin/standalone.sh -c $2 -b $3 -bmanagement $4
fi

edit /etc/systemd/system/wildfly.service as below:

[Unit]
Description=The WildFly Application Server
After=syslog.target network.target
Before=httpd.service

[Service]
Environment=LAUNCH_JBOSS_IN_BACKGROUND=1
EnvironmentFile=-/etc/wildfly/wildfly.conf
User=wildfly
LimitNOFILE=102642
PIDFile=/var/run/wildfly/wildfly.pid
ExecStart=/opt/wildfly/bin/launch.sh $WILDFLY_MODE $WILDFLY_CONFIG $WILDFLY_BIND $WILDFLY_CONSOLE_BIND
StandardOutput=null

[Install]
WantedBy=multi-user.target

sudo systemctl daemon-reload
sudo systemctl restart wildfly.service
That’s it! You can now access the admin console remotely…
http://192.168.0.43:9990/console/index.html
undefined