HBASE-2562 bin/hbase doesn't work in-situ in maven

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@945486 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-05-18 04:12:04 +00:00
parent 064e9fe7ab
commit 960a9c0d7a
2 changed files with 41 additions and 29 deletions

View File

@ -329,6 +329,8 @@ Release 0.21.0 - Unreleased
HBASE-2442 Log lease recovery catches IOException too widely HBASE-2442 Log lease recovery catches IOException too widely
(Todd Lipcon via Stack) (Todd Lipcon via Stack)
HBASE-2457 RS gets stuck compacting region ad infinitum HBASE-2457 RS gets stuck compacting region ad infinitum
HBASE-2562 bin/hbase doesn't work in-situ in maven
(Todd Lipcon via Stack)
IMPROVEMENTS IMPROVEMENTS
HBASE-1760 Cleanup TODOs in HTable HBASE-1760 Cleanup TODOs in HTable

View File

@ -40,6 +40,8 @@
# #
# HBASE_ROOT_LOGGER The root appender. Default is INFO,console # HBASE_ROOT_LOGGER The root appender. Default is INFO,console
# #
# MAVEN_HOME Where mvn is installed.
#
bin=`dirname "$0"` bin=`dirname "$0"`
bin=`cd "$bin"; pwd` bin=`cd "$bin"; pwd`
@ -83,6 +85,11 @@ shift
JAVA=$JAVA_HOME/bin/java JAVA=$JAVA_HOME/bin/java
JAVA_HEAP_MAX=-Xmx1000m JAVA_HEAP_MAX=-Xmx1000m
MVN="mvn"
if [ "$MAVEN_HOME" != "" ]; then
MVN=${MAVEN_HOME}/bin/mvn
fi
# check envvars which might override default args # check envvars which might override default args
if [ "$HBASE_HEAPSIZE" != "" ]; then if [ "$HBASE_HEAPSIZE" != "" ]; then
#echo "run with heapsize $HBASE_HEAPSIZE" #echo "run with heapsize $HBASE_HEAPSIZE"
@ -97,19 +104,29 @@ IFS=
CLASSPATH="${HBASE_CONF_DIR}" CLASSPATH="${HBASE_CONF_DIR}"
CLASSPATH=${CLASSPATH}:$JAVA_HOME/lib/tools.jar CLASSPATH=${CLASSPATH}:$JAVA_HOME/lib/tools.jar
# For developers, add hbase classes to CLASSPATH add_maven_deps_to_classpath() {
if [ -d "$HBASE_HOME/build/classes" ]; then f="/tmp/hbase-core-tets-classpath.txt"
CLASSPATH=${CLASSPATH}:$HBASE_HOME/build/classes ${MVN} -f core/pom.xml dependency:build-classpath -Dmdep.outputFile="${f}" &> /dev/null
fi # Add tests classes
if [ -d "$HBASE_HOME/build/test" ]; then CLASSPATH=${CLASSPATH}:`cat "${f}"`
CLASSPATH=${CLASSPATH}:$HBASE_HOME/build/test }
fi
if [ -d "$HBASE_HOME/build/webapps" ]; then
CLASSPATH=${CLASSPATH}:$HBASE_HOME/build
fi
# Add maven target directory add_maven_main_classes_to_classpath() {
if $in_sources_dir; then if [ -d "$HBASE_HOME/core/target/classes" ]; then
CLASSPATH=${CLASSPATH}:$HBASE_HOME/core/target/classes
fi
}
add_maven_test_classes_to_classpath() {
# For developers, add hbase classes to CLASSPATH
f="$HBASE_HOME/core/target/test-classes"
if [ -d "${f}" ]; then
CLASSPATH=${CLASSPATH}:${f}
fi
}
add_maven_target_dir_to_classpath() {
# I never seem to *have* such a dir. -tlipcon
HBASE_VER=`grep '<version>' $HBASE_HOME/pom.xml | head -1 | sed 's/.*<version>\(.*\)<\/version>/\1/'` HBASE_VER=`grep '<version>' $HBASE_HOME/pom.xml | head -1 | sed 's/.*<version>\(.*\)<\/version>/\1/'`
MAVEN_TARGET_DIR=$HBASE_HOME/target/hbase-$HBASE_VER-bin/hbase-$HBASE_VER MAVEN_TARGET_DIR=$HBASE_HOME/target/hbase-$HBASE_VER-bin/hbase-$HBASE_VER
if [ -d "$MAVEN_TARGET_DIR" ]; then if [ -d "$MAVEN_TARGET_DIR" ]; then
@ -119,6 +136,13 @@ if $in_sources_dir; then
fi fi
done done
fi fi
}
# Add maven target directory
if $in_sources_dir; then
add_maven_deps_to_classpath
add_maven_main_classes_to_classpath
add_maven_test_classes_to_classpath
fi fi
# For releases, add hbase & webapps to CLASSPATH # For releases, add hbase & webapps to CLASSPATH
@ -137,19 +161,11 @@ for f in $HBASE_HOME/lib/*.jar; do
CLASSPATH=${CLASSPATH}:$f; CLASSPATH=${CLASSPATH}:$f;
done done
# Add libs handled by ivy
if [ -d "$HBASE_HOME/build/ivy/lib/common" ]; then
for f in $HBASE_HOME/build/ivy/lib/common/*.jar; do
CLASSPATH=${CLASSPATH}:$f;
done
fi
# Add user-specified CLASSPATH last # Add user-specified CLASSPATH last
if [ "$HBASE_CLASSPATH" != "" ]; then if [ "$HBASE_CLASSPATH" != "" ]; then
CLASSPATH=${CLASSPATH}:${HBASE_CLASSPATH} CLASSPATH=${CLASSPATH}:${HBASE_CLASSPATH}
fi fi
# default log directory & file # default log directory & file
if [ "$HBASE_LOG_DIR" = "" ]; then if [ "$HBASE_LOG_DIR" = "" ]; then
HBASE_LOG_DIR="$HBASE_HOME/logs" HBASE_LOG_DIR="$HBASE_HOME/logs"
@ -195,15 +211,9 @@ if [ "$COMMAND" = "shell" ] ; then
CLASS="org.jruby.Main ${HBASE_HOME}/bin/hirb.rb" CLASS="org.jruby.Main ${HBASE_HOME}/bin/hirb.rb"
elif $in_sources_dir && [ "$COMMAND" = "shell-tests" ] ; then elif $in_sources_dir && [ "$COMMAND" = "shell-tests" ] ; then
# Finx maven build classpath # Finx maven build classpath
mvn -f core/pom.xml dependency:build-classpath -Dmdep.outputFile=/tmp/hbase-core-tests-classpath.txt &> /dev/null add_maven_deps_to_classpath
# Add tests classes add_maven_main_classes_to_classpath
CLASSPATH=${CLASSPATH}:`cat /tmp/hbase-core-tests-classpath.txt` add_maven_test_classes_to_classpath
for f in `find ${HBASE_HOME}/core/target -name '*.jar'`; do
if [ -f $f ]; then
CLASSPATH=${CLASSPATH}:$f;
fi
done
CLASSPATH=${HBASE_HOME}/core/target/test-classes:${CLASSPATH} # For configs
# Start the tests # Start the tests
CORESRC="${HBASE_HOME}/core/src" CORESRC="${HBASE_HOME}/core/src"
CLASS="org.jruby.Main -I${CORESRC}/main/ruby -I${CORESRC}/test/ruby ${CORESRC}/test/ruby/tests_runner.rb" CLASS="org.jruby.Main -I${CORESRC}/main/ruby -I${CORESRC}/test/ruby ${CORESRC}/test/ruby/tests_runner.rb"