diff --git a/bin/ycsb.bat b/bin/ycsb.bat index f8ea7b4e25..36788858a9 100644 --- a/bin/ycsb.bat +++ b/bin/ycsb.bat @@ -144,7 +144,11 @@ GOTO classpathComplete :gotSource @REM Check for some basic libraries to see if the source has been built. -IF EXIST "%YCSB_HOME%\%BINDING_DIR%\target\*.jar" GOTO gotJars +IF EXIST "%YCSB_HOME%\core\target\dependency\*.jar" ( + IF EXIST "%YCSB_HOME%\%BINDING_DIR%\target\*.jar" ( + GOTO gotJars + ) +) @REM Call mvn to build source checkout. IF "%BINDING_NAME%" == "basic" GOTO buildCore @@ -155,7 +159,7 @@ SET MVN_PROJECT=core :gotMvnProject ECHO [WARN] YCSB libraries not found. Attempting to build... -CALL mvn -pl com.yahoo.ycsb:%MVN_PROJECT% -am package -DskipTests +CALL mvn -Psource-run -pl com.yahoo.ycsb:%MVN_PROJECT% -am package -DskipTests IF %ERRORLEVEL% NEQ 0 ( ECHO [ERROR] Error trying to build project. Exiting. GOTO exit @@ -167,6 +171,11 @@ FOR %%F IN (%YCSB_HOME%\core\target\*.jar) DO ( SET CLASSPATH=!CLASSPATH!;%%F% ) +@REM Core dependency libraries +FOR %%F IN (%YCSB_HOME%\core\target\dependency\*.jar) DO ( + SET CLASSPATH=!CLASSPATH!;%%F% +) + @REM Database conf (need to find because location is not consistent) FOR /D /R %YCSB_HOME%\%BINDING_DIR% %%F IN (*) DO ( IF "%%~nxF" == "conf" SET CLASSPATH=!CLASSPATH!;%%F% diff --git a/bin/ycsb.sh b/bin/ycsb.sh index d62c22a4e4..f7fa86d379 100755 --- a/bin/ycsb.sh +++ b/bin/ycsb.sh @@ -167,25 +167,21 @@ if $DISTRIBUTION; then # Source checkout else # Check for some basic libraries to see if the source has been built. - for f in "$YCSB_HOME"/"$BINDING_DIR"/target/*.jar ; do - + if ! ls "$YCSB_HOME"/core/target/*.jar 1> /dev/null 2>&1 || \ + ! ls "$YCSB_HOME"/"$BINDING_DIR"/target/*.jar 1>/dev/null 2>&1; then # Call mvn to build source checkout. - if [ ! -e "$f" ] ; then - if [ "$BINDING_NAME" = "basic" ] ; then - MVN_PROJECT=core - else - MVN_PROJECT="$BINDING_DIR"-binding - fi - - echo "[WARN] YCSB libraries not found. Attempting to build..." - mvn -pl com.yahoo.ycsb:"$MVN_PROJECT" -am package -DskipTests - if [ "$?" -ne 0 ] ; then - echo "[ERROR] Error trying to build project. Exiting." - exit 1; - fi + if [ "$BINDING_NAME" = "basic" ] ; then + MVN_PROJECT=core + else + MVN_PROJECT="$BINDING_DIR"-binding fi - done + echo "[WARN] YCSB libraries not found. Attempting to build..." + if mvn -Psource-run -pl com.yahoo.ycsb:"$MVN_PROJECT" -am package -DskipTests; then + echo "[ERROR] Error trying to build project. Exiting." + exit 1; + fi + fi # Core libraries for f in "$YCSB_HOME"/core/target/*.jar ; do @@ -194,13 +190,19 @@ else fi done + # Core dependency libraries + for f in "$YCSB_HOME"/core/target/dependency/*.jar ; do + if [ -r "$f" ] ; then + CLASSPATH="$CLASSPATH:$f" + fi + done + # Database conf (need to find because location is not consistent) CLASSPATH_CONF=$(find "$YCSB_HOME"/$BINDING_DIR -name "conf" | while IFS="" read -r file; do echo ":$file"; done) if [ "x$CLASSPATH_CONF" != "x" ]; then CLASSPATH="$CLASSPATH$CLASSPATH_CONF" fi - # Database libraries for f in "$YCSB_HOME"/"$BINDING_DIR"/target/*.jar ; do if [ -r "$f" ] ; then diff --git a/core/pom.xml b/core/pom.xml index 13bd4d10dc..14dc686368 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -60,6 +60,7 @@ LICENSE file. 2.1.4 + @@ -68,4 +69,31 @@ LICENSE file. + + + + + source-run + + + + org.apache.maven.plugins + maven-dependency-plugin + + + stage-dependencies + package + + copy-dependencies + + + runtime + + + + + + + +