Skip to content

Instantly share code, notes, and snippets.

@eristoddle
Forked from rzrbld/bash-artifactxml-gen.sh
Created September 1, 2017 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eristoddle/edfaf53ea8f93208dd156dd5c5b372cb to your computer and use it in GitHub Desktop.
Save eristoddle/edfaf53ea8f93208dd156dd5c5b372cb to your computer and use it in GitHub Desktop.
wso2 studio developer artifact.xml generator
#!/bin/bash
# using: bash-artifactxml-gen.sh my.project.folder
#
ROOTFOLDER=$*
#set src dir
SRCDIR=$ROOTFOLDER'/src/';
#cd to src dir
cd $SRCDIR;
#start gen artifact.xml
echo '<?xml version="1.0" encoding="UTF-8"?><artifacts>';
#foreach all xml (except pom.xml and artifact.xml) files in src directory
for D in `find . -name '*.xml' ! -name 'pom.xml' ! -name 'artifact.xml'`
do
#set full filename
FILENAME=`echo $D | awk 'BEGIN { RS = "/" }; END {print $1}'`;
#set foldername
FOLDERNAME=`echo $D | awk 'BEGIN { FS = "/" }; END {print $4}'`;
#set filename whitout extension .xml
FNAME=`echo $FILENAME | awk 'BEGIN {FS = ".xml"}; END {print $1}'`;
#replace dot and slash in filepath
PATHTOXML=`echo $D | sed 's/^.\///g'`;
#set type
TYPE=`echo $FOLDERNAME | sed 's/local-entries/local-entry/g;s/proxy-services/proxy-service/g;s/sequences/sequence/g;s/endpoints/endpoint/g;'`
#out each artifact string
echo '<artifact name="'$FNAME'" groupId="com.example.'$ROOTFOLDER'" version="1.0.0" type="synapse/'$TYPE'" serverRole="EnterpriseServiceBus">
<file>src/'$PATHTOXML'</file>
</artifact>'
done
#hmm seems really done
echo '</artifacts>';
#now just copy-paste
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment