-#!/bin/sh
+#!/bin/bash
+# Name of this project, detected by it's base path
NAME="${PWD##*/}"
+
+# Generated JAR file
DIST="dist/${NAME}.jar"
+
+# WildFly module base path
+WILDFLY_MODULE_BASE_PATH="${HOME}/wildfly_domain/modules/org/mxchange"
+
+# And for this "module" (as WildFly calls it)
+WILDFLY_MODULE_PATH="${WILDFLY_MODULE_BASE_PATH}/${NAME}/main"
+
+# module.xml
+WILDFLY_MODULE_XML_FILE="wildfly/module.xml"
+
+# Generate list
LIST=`find ../*/lib/${NAME}.jar`
LIST="${LIST} `find ../*/*-ejb/lib/${NAME}.jar`"
-LIST="${LIST} ${HOME}/gf_domains/domain1/lib/"
+LIST="${LIST} ${WILDFLY_MODULE_PATH}"
+
+if [ ! -f "${DIST}" ]
+then
+ echo "$0: '${DIST}' not found."
+ exit 1
+elif [ ! -d "${WILDFLY_MODULE_BASE_PATH}" ]
+then
+ echo "$0: WildFly base path '${WILDFLY_MODULE_BASE_PATH}' not created."
+ exit 1
+elif [ ! -d "${WILDFLY_MODULE_PATH}" ]
+then
+ mkdir -vp "${WILDFLY_MODULE_PATH}"
+fi
for target in ${LIST};
do
- if [ ! -f "${DIST}" ]
- then
- echo "$0: '${DIST}' not found."
- elif [ -d "${target}" ]
+ if [ -d "${target}" ]
then
cp -v "${DIST}" "${target}"
elif [ -f "${target}" ]
echo "$0: Target '${target}' not found."
fi
done
+
+# Copy module.xml ...
+if [ -f "${WILDFLY_MODULE_XML_FILE}" ]
+then
+ echo "$0: Generating module.xml ..."
+ XML_CONTENT=`cat "${WILDFLY_MODULE_XML_FILE}"`
+ XML_CONTENT="${XML_CONTENT//NAME/$NAME}"
+ echo "${XML_CONTENT}" > "${WILDFLY_MODULE_PATH}/module.xml"
+fi
+
+echo "$0: All done."
+exit 0
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<module xmlns="urn:jboss:module:1.1" name="org.mxchange.NAME">
+ <resources>
+ <resource-root path="NAME.jar"/>
+ </resources>
+
+ <dependencies>
+ <module name="javax.api"/>
+ </dependencies>
+</module>