Skip to content

Instantly share code, notes, and snippets.

@snt
Created March 17, 2018 03:07
Show Gist options
  • Save snt/1a75d0de2b1398a980b2acbf69e512f4 to your computer and use it in GitHub Desktop.
Save snt/1a75d0de2b1398a980b2acbf69e512f4 to your computer and use it in GitHub Desktop.
Generate loose application XML of WebSphere Liberty Profile.
#!/bin/sh
# https://www.ibm.com/support/knowledgecenter/ja/SS7K4U_liberty/com.ibm.websphere.wlp.zseries.doc/ae/rwlp_loose_applications.html
# put its content into apps/application-name.war.xml
TMDIR=$(cd dirname $0; echo $PWD)
cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<archive>
<dir sourceOnDisk="${TMDIR?}/WebContent" targetInArchive="/"/>
<dir sourceOnDisk="${TMDIR?}/target/classes" targetInArchive="/WEB-INF/classes"/>
EOF
mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:list -DoutputAbsoluteArtifactFilename=true -DoutputScope=true | grep jar | tr ':' ' ' | awk '{print $6, $7}' | grep -v ^provided | grep -v ^test | awk '{print $2}' | ( while read line; do echo " <file sourceOnDisk=\"${line}\" targetInArchive=\"/WEB-INF/lib/$(basename $line)\"/>"; done )
echo '</archive>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment