#!/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 Hot Folder and Wrap Sample App/config"/* rm -rf "$PROJECT_ROOT/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib"/* # Clear the src/bin dir containing compiled class files rm -rf "$PROJECT_ROOT/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin"/* #find and compile all java files find "$PROJECT_ROOT/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/src" -name "*.java" -exec javac -d "$PROJECT_ROOT/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin" -cp "$PROJECT_ROOT/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/*" {} + # Package the compiled classes into a JAR file jar cvf "$PROJECT_ROOT/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/sample-app.jar" -C "$PROJECT_ROOT/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin" . # Copy all libs and config files to bin cp -r "$PROJECT_ROOT/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib"/* "$PROJECT_ROOT/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib" cp -r "$PROJECT_ROOT/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config"/* "$PROJECT_ROOT/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config"