aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/shell/mk_jboss_module
blob: 28d0540b13d4676e9529b1a9b4df8cdfdacfdc28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
#
#  mk_jboss_module -- This script builds a JBoss module for MDBC.  It should be run directly
#  in the directory containing the MDBC code.  It will build the MDBC jar file (under
#  target/mdbc-jboss-module.tar), and then construct a tar file containing MDBC and all of
#  its dependencies, as well as other files needed for a JBoss module.
#
#  To install the module: untar the tar file on the server in the JBOSS_DIR/modules directory.
#

if [ ! -f pom.xml ]
then
	echo mk_jboss_module: Where is pom.xml?
	exit 1
fi

mvn -Dmaven.test.skip=true package
if [ $? != 0 ]
then
	echo mk_jboss_module: maven failed...
	exit 1
fi

T=/tmp/mk_jboss_module$$
T2=$T/com/att/research/mdbc/main
MODULE=$T2/module.xml
TARGET=`pwd`/target/mdbc-jboss-module.tar
JARS=$( mvn dependency:build-classpath | grep -v INFO | tr : '\012' )

mkdir -p $T2
cp $JARS $T2
cp target/mdbc-0.0.1-SNAPSHOT.jar $T2
JAR2=$( cd $T2; ls *.jar )

cat > $MODULE <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Note: This module includes a copy of the H2 database, rather than depending on the
  com.h2database.h2 module included with JBoss, because I could not get that copy to work.
-->
<module xmlns="urn:jboss:module:1.1" name="com.att.research.mdbc">
  <resources>
EOF
for i in $JAR2; do echo "    <resource-root path=\"$i\"/>"; done >> $MODULE
cat >> $MODULE <<EOF
  </resources>
  <dependencies>
    <module name="javax.api"/>
    <module name="sun.jdk"/>
  </dependencies>
</module>
EOF
chmod 444 $T2/*.jar $MODULE

mkdir -p target
(cd $T; tar cf $TARGET com )
rm -fr $T