#!/bin/sh
echo off
echo [INFO] Use maven tomcat-plugin run the project.

CWD=`pwd`
cd $CWD
cd ..

mvn compile -o -e

echo --------------------- Set Jrebel ---------------------
export REBEL_HOME=./bin
export REBEL_CLASS_PATH=./target/classes
export MAVEN_OPTS="$MAVEN_OPTS -javaagent:$REBEL_HOME/jrebel.jar -noverify -Drebel.spring_plugin=true -Drebel.hibernate_plugin=true"
export MAVEN_OPTS="$MAVEN_OPTS -Drebel.dirs=$REBEL_CLASS_PATH"
echo ${MAVEN_OPTS}

echo --------------------- Set Jmxremote ---------------------
export JMX_OPTS=
export JMX_OPTS="$JMX_OPTS -Dcom.sun.management.jmxremote=true"
export JMX_OPTS="$JMX_OPTS -Dcom.sun.management.jmxremote.port=9090"
export JMX_OPTS="$JMX_OPTS -Dcom.sun.management.jmxremote.ssl=false"
export JMX_OPTS="$JMX_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
echo ${JMX_OPTS}

echo --------------------- Set Maven ---------------------
export MAVEN_OPTS="$JMX_OPTS $MAVEN_OPTS -XX:MaxPermSize=256m"
echo ${MAVEN_OPTS}

echo --------------------- RUN ---------------------
mvn tomcat:run -Dmaven.test.skip=true -e -o
