Glassfish Directory Deployment (explode Ear)
Recently I was struggeling with glassfish directory deployment. Actually it is quite easy:
- unzip the ear-File (eg. example.ear) to a directory without .ear
- then go into this directory and unzip all war and jar files to directories named _jar and _war (only on this directory level, don’t touch the files in /lib)
- now copy the folder into your domains-autodeploy-folder
For more convenience, use this script. I think it is selfexplaining.
earexploder.sh example.ear
FILE: earexploder.sh
#!/bin/bash
EAR=$1
EARDIR=${EAR%.ear}
unzip $EAR -d $EARDIR
cd $EARDIR
for ARCHIVE in $(ls -1 *.jar); do
ARCHIVEDIR=${ARCHIVE%.jar}
ARCHIVEDIR=${ARCHIVEDIR}_jar
unzip $ARCHIVE -d $ARCHIVEDIR
done
for ARCHIVE in $(ls -1 *.war); do
ARCHIVEDIR=${ARCHIVE%.war}
ARCHIVEDIR=${ARCHIVEDIR}_war
unzip $ARCHIVE -d $ARCHIVEDIR
done