#!/bin/bash set -e # Set the project root directory PROJECT_ROOT=$(dirname "$0")/.. # Clean all bin folders rm -rf "$PROJECT_ROOT/Sample Code/bin/Protect With Independent Rights & Wrap/config"/* rm -rf "$PROJECT_ROOT/Sample Code/bin/Protect With Independent Rights & Wrap/lib"/* # Clear the src/bin dir containing compiled class files rm -rf "$PROJECT_ROOT/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin"/* #find and compile all java files find "$PROJECT_ROOT/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src" -name "*.java" -exec javac -d "$PROJECT_ROOT/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin" -cp "$PROJECT_ROOT/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/*" {} + # Package the compiled classes into a JAR file jar cvf "$PROJECT_ROOT/Sample Code/bin/Protect With Independent Rights & Wrap/lib/sample-app.jar" -C "$PROJECT_ROOT/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin" . # Copy all libs and config files to bin cp -r "$PROJECT_ROOT/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib"/* "$PROJECT_ROOT/Sample Code/bin/Protect With Independent Rights & Wrap/lib" cp -r "$PROJECT_ROOT/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config"/* "$PROJECT_ROOT/Sample Code/bin/Protect With Independent Rights & Wrap/config"