Skip to content

Instantly share code, notes, and snippets.

@ushkinaz
Last active October 2, 2015 10:17
Show Gist options
  • Save ushkinaz/2226184 to your computer and use it in GitHub Desktop.
Save ushkinaz/2226184 to your computer and use it in GitHub Desktop.
Rebuild and launch
#!/bin/bash
# Builds and runs curent module in a jetty container
# Usage:
# jet [profile]
#
# Dependencies:
# maven
# pv
#
USAGE="$0 [profile]"
CURRENT_MODULE=$(pwd | sed s/.*[/]//)
if [[ $# -eq 1 ]]; then
echo "Using profile $1"
MAVEN_OPS="-P $1"
shift
fi
module=$CURRENT_MODULE
goal=jetty:run
pushd .
cd ../pokedex/
echo "Building $module and dependencies"
mvn $MAVEN_OPS -T 2.0C -am -pl :$module -DskipTests clean install
RETCODE=$?
popd
if [ $RETCODE -eq "0" ]
then
echo "Starting $module by $goal"
mvn $MAVEN_OPS -q -pl :$module $goal -DskipTests -Dcatalina.home=/var/log
else
echo "Build failed"
fi
#!/bin/bash
build_env=nxt
function on_build_start {
start_time=`date +%s`
}
function on_build_end {
end_time=`date +%s`
duration=`expr $end_time - $start_time`
if [[ $1 -ne 0 ]]; then
notify-send --urgency=low -t 100 -i error "Full test failed, took $duration seconds."
else
notify-send --urgency=low -t 100 -i info "Full test completed, took $duration seconds."
fi
exit $1
}
function check_result {
if [[ $1 -ne 0 ]]; then
on_build_end $1
fi
}
start_time=`date +%s`
mvn --fail-fast -B -T 2.0C -P $build_env,-reports -DskipTests clean install
check_result $?
mvn clean test -P $build_env,-reports
check_result $?
mvn clean test -Dtest=ContextInitializationTest -Dtest.groups=integration -P $build_env,-reports
check_result $?
on_build_end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment