#!/bin/sh

#
# Copyright The WildFly Authors
# SPDX-License-Identifier: Apache-2.0
#

# -----------------------------------------------------------------------------
# Apache Maven YourKit Profiler Startup Script
#
# Environment Variable Prerequisites
#
#   JAVA_HOME       Must point at your Java Development Kit installation.
#   MAVEN_OPTS      (Optional) Java runtime options used when Maven is executed.
#   MAVEN_SKIP_RC   (Optional) Flag to disable loading of mavenrc files.
# -----------------------------------------------------------------------------

if [ ! -f "$YJPLIB" ]; then
  echo "Error: Unable to autodetect the YJP library location. Please set YJPLIB variable" >&2
  exit 1
fi

env MAVEN_OPTS="-agentpath:$YJPLIB=onexit=snapshot,onexit=memory,tracing,onlylocal $MAVEN_OPTS" "`dirname "$0"`/mvn" "$@"
