Generate war file from tomcat webapp folder

前端 未结 4 1163
醉话见心
醉话见心 2020-12-12 13:06

I have a tomcat server working, and there I have a webapp folder my_web_app.

I didn\'t deploy the project; I only have that folder of that application (

4条回答
  •  醉话见心
    2020-12-12 13:38

    Create the war file in a different directory to where the content is otherwise the jar command might try to zip up the file it is creating.

    #!/bin/bash
    
    set -euo pipefail
    
    war=app.war
    src=contents
    
    # Clean last war build
    if [ -e ${war} ]; then
        echo "Removing old war ${war}"
        rm -rf ${war}
    fi
    
    # Build war
    if [ -d ${src} ]; then
        echo "Found source at ${src}"
        cd ${src}
        jar -cvf ../${war} *
        cd ..
    fi
    
    # Show war details
    ls -la ${war}
    

提交回复
热议问题