How to deploy a war file in GlassFish 4 server Using Jenkins

后端 未结 3 1486
谎友^
谎友^ 2021-01-22 12:18

I am using Jenkins to deploy a war file in GlassFish 4 server.But unable to deploy war file in Glassfish 4 server.
I am following below process.

But it giv

3条回答
  •  故里飘歌
    2021-01-22 12:34

    I was able to delopy to glassfish 4 using any one method from following two methods:

    1. Method 1 Using new version of Deploy to container Plugin

      You can clone following from github (Note: you can try with new version of plugin)

      https://github.com/jenkinsci/deploy-plugin/tree/205715c3556ade8d8665de677ebb41e35ee64793

      Now build the project and in target folder you can find deploy.hpi file which can be install in jenkins. This version has support for Glassfish 4.

      To install plugin manually: How to install a plugin in Jenkins manually

    2. Method 2 Add following in jenkins as execute shell.Update the value as required and create glassfish password file.It will undelpoy the ear file and deploy the new one.

    #!/bin/bash
    
    # FOR JENKINS
    
    # Update following values as required
    GLASSFISH_PASSWORD_FILE_PATH=/home/pwd
    
    ASADMIN_PATH="/home/glassfish4/glassfish/bin/asadmin"
    ASADMIN_BASE_CMD="$ASADMIN_PATH --host 10.13.209.100 --port 9048 --user admin2 --passwordfile $GLASSFISH_PASSWORD_FILE_PATH"
    
    DEPLOY_EAR_FILE_PATH="Dummy-project-ear/target"
    DEPLOY_EAR_FILE_NAME="Dummy-project-ear-1.0-SNAPSHOT.ear"
    
    UNDEPLOY_EAR_NAME="Dummy-project-ear-1.0-SNAPSHOT"
    
    # Commands
    
    $ASADMIN_BASE_CMD list-applications
    $ASADMIN_BASE_CMD undeploy $UNDEPLOY_EAR_NAME
    $ASADMIN_BASE_CMD deploy $DEPLOY_EAR_FILE_PATH/$DEPLOY_EAR_FILE_NAME
    

提交回复
热议问题