HBASE-17997: In dev environment, add jruby-complete jar to classpath only when jruby is needed
Signed-off-by: tedyu <yuzhihong@gmail.com>
This commit is contained in:
parent
3e426b2f85
commit
4ab94744e2
19
bin/hbase
19
bin/hbase
|
@ -320,11 +320,20 @@ if [[ $jruby_needed ]]; then
|
|||
HBASE_OPTS="$HBASE_OPTS -Djruby.home=$JRUBY_HOME -Djruby.lib=$JRUBY_HOME/lib"
|
||||
|
||||
else # JRUBY_HOME is not specified explicitly
|
||||
# add jruby packaged with HBase to CLASSPATH
|
||||
JRUBY_PACKAGED_WITH_HBASE="$HBASE_HOME/lib/ruby/*.jar"
|
||||
for jruby_jar in $JRUBY_PACKAGED_WITH_HBASE; do
|
||||
CLASSPATH=$jruby_jar:$CLASSPATH;
|
||||
done
|
||||
if $in_dev_env; then # in dev environment
|
||||
F_JRUBY="${HBASE_HOME}/target/cached_classpath_jruby.txt"
|
||||
if [ ! -f "${F_JRUBY}" ]; then
|
||||
echo "As this is a development environment, we need ${F_JRUBY} to be generated from maven (command: mvn install -DskipTests)"
|
||||
exit 1
|
||||
fi
|
||||
CLASSPATH=$(cat "${F_JRUBY}"):$CLASSPATH;
|
||||
else # not in dev environment
|
||||
# add jruby packaged with HBase to CLASSPATH
|
||||
JRUBY_PACKAGED_WITH_HBASE="$HBASE_HOME/lib/ruby/*.jar"
|
||||
for jruby_jar in $JRUBY_PACKAGED_WITH_HBASE; do
|
||||
CLASSPATH=$jruby_jar:$CLASSPATH;
|
||||
done
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
@ -286,10 +286,23 @@ if defined jruby-needed (
|
|||
|
||||
@rem JRUBY_HOME is not defined
|
||||
if not defined JRUBY_HOME (
|
||||
@rem add jruby packaged with HBase to CLASSPATH
|
||||
set JRUBY_PACKAGED_WITH_HBASE=%HBASE_HOME%\lib\ruby\*
|
||||
if defined jruby-needed (
|
||||
set CLASSPATH=!JRUBY_PACKAGED_WITH_HBASE!;!CLASSPATH!
|
||||
@rem in dev environment
|
||||
if "%in_dev_env%"=="true" (
|
||||
set cached_classpath_jruby_filename=%HBASE_HOME%\target\cached_classpath_jruby.txt
|
||||
if not exist "!cached_classpath_jruby_filename!" (
|
||||
echo "As this is a development environment, we need !cached_classpath_jruby_filename! to be generated from maven (command: mvn install -DskipTests)"
|
||||
goto :eof
|
||||
)
|
||||
for /f "delims=" %%i in ('type "!cached_classpath_jruby_filename!"') do set CLASSPATH=%%i;%CLASSPATH%
|
||||
)
|
||||
|
||||
@rem not in dev environment
|
||||
if "%in_dev_env%"=="false" (
|
||||
@rem add jruby packaged with HBase to CLASSPATH
|
||||
set JRUBY_PACKAGED_WITH_HBASE=%HBASE_HOME%\lib\ruby\*
|
||||
if defined jruby-needed (
|
||||
set CLASSPATH=!JRUBY_PACKAGED_WITH_HBASE!;!CLASSPATH!
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -103,8 +103,25 @@
|
|||
</goals>
|
||||
<configuration>
|
||||
<outputFile>${project.parent.basedir}/target/cached_classpath.txt</outputFile>
|
||||
<excludeArtifactIds>jruby-complete</excludeArtifactIds>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
<execution>
|
||||
<!-- Generates a file containing jruby jar.
|
||||
In dev environment, bin/hbase will read the file and add the jar into classpath when jruby is needed
|
||||
-->
|
||||
<id>create-hbase-generated-classpath-jruby</id>
|
||||
<phase>test</phase>
|
||||
<goals>
|
||||
<goal>build-classpath</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputFile>${project.parent.basedir}/target/cached_classpath_jruby.txt</outputFile>
|
||||
<includeArtifactIds>jruby-complete</includeArtifactIds>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
<!--
|
||||
Build an aggregation of our templated NOTICE file and the NOTICE files in our dependencies.
|
||||
If MASSEMBLY-382 is fixed we could do this in the assembly
|
||||
|
|
Loading…
Reference in New Issue