summaryrefslogtreecommitdiffstats
path: root/Monitoring/MonitoringTool/PacketTracking/scripts/m2classpath.sh
blob: b39c22e1caab4cedd0e436f577c7b93208cb3ed9 (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/sh
# Bootstrap CAN project
#
# ==[ START CONFIG ]==
JAVA=java

# ==[ END CONFIG ]==
CMD=$1
M2CLASSPATH=$2
CLASSPATH_FILE=.m2classpath
usage () {
  cat <<EOT
=======[ Maven Classpath extractor]=======

Extracts maven class path for launching scripts.

USAGE:  this script should be called from within maven using
        the exec-maven-plugin via "mvn compile exec:exec" 
         <reporting>
            <plugins>
              <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.1</version>
                <configuration>
                  <executable>../scripts/m2classpath.sh</executable>
                  <arguments>
                    <argument>create_classpath_file</argument>
                    <classpath />
                 </arguments>
              </configuration>
             </plugin>
            </plugins>
         </reporting>

EOT
}
# ==[ create classh path file via maven ]==
create_classpath_file () {
  if [ "$M2CLASSPATH" != "" ]; then
     echo "#=> Creating $CLASSPATH_FILE"
     # FIXME worldmap target class path
     echo ./target/classes:../../worldmap/target/classes:$M2CLASSPATH > $CLASSPATH_FILE
  else 
     echo "ERROR: this script must be called via 'mvn compile exec:exec'"
  fi
}
# ==[ main switch ]==
case $CMD in
  create_classpath_file)
    create_classpath_file
  ;;
  *)
    usage
  ;;
esac