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

Leave a Reply

Your email address will not be published. Required fields are marked *