Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 31 lines (21 sloc) 715 Bytes
#!/usr/bin/env bash
# bin/compile <build-dir> <cache-dir> <env-dir>
# fail fast
set -e
BPLOG_PREFIX="buildpack.java"
BP_DIR=$(cd $(dirname $0)/..; pwd) # absolute path
BUILD_DIR=$1
CACHE_DIR=$2
ENV_DIR=$3
source $BP_DIR/lib/common.sh
source $BP_DIR/lib/maven.sh
source <(curl -s --retry 3 -L $BUILDPACK_STDLIB_URL)
export_env $ENV_DIR "." "JAVA_OPTS|JAVA_TOOL_OPTIONS"
install_jdk ${BUILD_DIR}
[ -n "$(find ${BUILD_DIR} -type f -name "*.kt")" ] && mcount "kotlin.source"
[ -n "$(find ${BUILD_DIR} -type f -name "*.groovy")" ] && mcount "groovy.source"
run_mvn "compile" $BUILD_DIR $CACHE_DIR
if has_maven_wrapper $BUILD_DIR; then
cache_copy ".m2/wrapper" $BUILD_DIR $CACHE_DIR
rm -rf $BUILD_DIR/.m2
fi