3 # Name of this project, detected by it's base path
7 DIST="dist/${NAME}.jar"
10 DIST_CONFIG_FILE="${HOME}/.jprojects-dist.sh"
12 # WildFly module base path
13 WILDFLY_MODULE_BASE_PATH="${HOME}/wildfly_domain/modules/org/mxchange"
15 # And for this "module" (as WildFly calls it)
16 WILDFLY_MODULE_PATH="${WILDFLY_MODULE_BASE_PATH}/${NAME}/main"
19 WILDFLY_MODULE_XML_FILE="wildfly/module.xml"
21 # Glassfish base path (domain)
22 GLASSFISH_BASE_PATH="${HOME}/gf_domain/lib"
24 # Windows personal domain
25 PERSONAL_DOMAIN_PATH="${HOME}/personal_domain/lib"
27 # Is the configuration file there?
28 if [ ! -f "${DIST_CONFIG_FILE}" ]
30 echo "$0: Configuration file '${DIST_CONFIG_FILE}' not found"
32 echo "Following variables are needed for SSH upload:"
33 echo "- GLASSFISH_SSH_PATH"
34 echo "- GLASSFISH_SSH_USER"
35 echo "- GLASSFISH_SSH_SERVER"
37 echo "And create a password-less SSH key."
41 source "${DIST_CONFIG_FILE}"
45 LIST=$(find ../*/lib/${NAME}.jar)
46 LIST="${LIST} ${WILDFLY_MODULE_PATH}"
48 if [ "${NAME}" != "jcore" -a "${NAME}" != "jcore-swing" ]
50 if [ -d "${GLASSFISH_BASE_PATH}" ]
52 echo "$0: Glassfish personal domain found, adding to LIST ..."
53 LIST="${LIST} ${GLASSFISH_BASE_PATH}"
56 if [ -d "${PERSONAL_DOMAIN_PATH}" ]
58 echo "$0: Personal domain found, adding to LIST ..."
59 LIST="${LIST} ${PERSONAL_DOMAIN_PATH}"
62 echo "$0: Not going to add '${NAME}' to distribution list, is JavaSE project."
67 echo "$0: '${DIST}' not found."
69 elif [ ! -d "${WILDFLY_MODULE_BASE_PATH}" ]
71 echo "$0: WildFly base path '${WILDFLY_MODULE_BASE_PATH}' not created."
72 elif [ ! -d "${WILDFLY_MODULE_PATH}" ]
74 mkdir -vp "${WILDFLY_MODULE_PATH}"
77 for project in ${LIST};
79 if [ -d "${project}" ]
81 cp -v "${DIST}" "${project}"
82 elif [ -f "${project}" ]
84 cp -v "${DIST}" "${project}"
86 echo "$0: Project '${project}' not found."
90 if [ "$1" = "r" -o "${NAME}" = "jcore" -o "${NAME}" = "jcore-swing" ]
92 echo "$0: Not uploading '${NAME}' or parameter 'r' provided."
93 elif [ -n "${GLASSFISH_SSH_USER}" -a -n "${GLASSFISH_SSH_SERVER}" -a -n "${GLASSFISH_SSH_PATH}" ]
95 echo "$0: Copying to remote '${GLASSFISH_SSH_SERVER}' ..."
96 scp "${DIST}" "${GLASSFISH_SSH_USER}@${GLASSFISH_SSH_SERVER}:${GLASSFISH_SSH_PATH}" || exit 255
98 echo "$0: SSH upload disabled."
101 # Copy module.xml ...
102 if [ -f "${WILDFLY_MODULE_XML_FILE}" ]
104 echo "$0: Generating module.xml ..."
105 XML_CONTENT=$(cat "${WILDFLY_MODULE_XML_FILE}")
106 XML_CONTENT="${XML_CONTENT//NAME/$NAME}"
107 echo "${XML_CONTENT}" > "${WILDFLY_MODULE_PATH}/module.xml"