Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NoClassDefFoundError when running pulsar cli tools in dev directory #10807

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions bin/bookkeeper
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Expand Down Expand Up @@ -121,7 +121,10 @@ add_maven_deps_to_classpath() {
f="${BK_HOME}/distribution/server/target/classpath.txt"
if [ ! -f "${f}" ]
then
${MVN} -f "${BK_HOME}/pom.xml" dependency:build-classpath -Dmdep.outputFile="${f}" &> /dev/null
(
cd "${BK_HOME}"
${MVN} -pl distribution/server generate-sources &> /dev/null
)
fi
BOOKIE_CLASSPATH=${CLASSPATH}:`cat "${f}"`
}
Expand Down
5 changes: 4 additions & 1 deletion bin/function-localrunner
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ add_maven_deps_to_classpath() {
f="${PULSAR_HOME}/distribution/server/target/classpath.txt"
if [ ! -f "${f}" ]
then
${MVN} -f "${PULSAR_HOME}/pom.xml" dependency:build-classpath -DincludeScope=compile -Dmdep.outputFile="${f}" &> /dev/null
(
cd "${PULSAR_HOME}"
${MVN} -pl distribution/server generate-sources &> /dev/null
)
fi
PULSAR_CLASSPATH=${CLASSPATH}:`cat "${f}"`
}
Expand Down
5 changes: 4 additions & 1 deletion bin/pulsar
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@ add_maven_deps_to_classpath() {
f="${PULSAR_HOME}/distribution/server/target/classpath.txt"
if [ ! -f "${f}" ]
then
${MVN} -f "${PULSAR_HOME}/pom.xml" dependency:build-classpath -DincludeScope=compile -Dmdep.outputFile="${f}" &> /dev/null
(
cd "${PULSAR_HOME}"
${MVN} -pl distribution/server generate-sources &> /dev/null
)
fi
PULSAR_CLASSPATH=${CLASSPATH}:`cat "${f}"`
}
Expand Down
5 changes: 4 additions & 1 deletion bin/pulsar-admin-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ add_maven_deps_to_classpath() {
f="${PULSAR_HOME}/distribution/server/target/classpath.txt"
if [ ! -f "${f}" ]
then
${MVN} -f "${PULSAR_HOME}/pom.xml" dependency:build-classpath -DincludeScope=compile -Dmdep.outputFile="${f}" &> /dev/null
(
cd "${PULSAR_HOME}"
${MVN} -pl distribution/server generate-sources &> /dev/null
)
fi
PULSAR_CLASSPATH=${CLASSPATH}:`cat "${f}"`
}
Expand Down
15 changes: 9 additions & 6 deletions bin/pulsar-client
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Expand Down Expand Up @@ -41,14 +41,14 @@ else
fi

# exclude tests jar
RELEASE_JAR=`ls $PULSAR_HOME/pulsar-*.jar 2> /dev/null | grep -v tests | tail -1`
RELEASE_JAR=`ls $PULSAR_HOME/pulsar-*.jar 2> /dev/null | grep -v tests | tail -1`
if [ $? == 0 ]; then
PULSAR_JAR=$RELEASE_JAR
fi

# exclude tests jar
BUILT_JAR=`ls $PULSAR_HOME/pulsar-client-tools/target/pulsar-*.jar 2> /dev/null | grep -v tests | tail -1`
if [ $? != 0 ] && [ ! -e "$PULSAR_JAR" ]; then
if [ $? != 0 ] && [ ! -e "$PULSAR_JAR" ]; then
echo "\nCouldn't find pulsar jar.";
echo "Make sure you've run 'mvn package'\n";
exit 1;
Expand All @@ -61,14 +61,17 @@ add_maven_deps_to_classpath() {
if [ "$MAVEN_HOME" != "" ]; then
MVN=${MAVEN_HOME}/bin/mvn
fi

# Need to generate classpath from maven pom. This is costly so generate it
# and cache it. Save the file into our target dir so a mvn clean will get
# clean it up and force us create a new one.
f="${PULSAR_HOME}/distribution/server/target/classpath.txt"
if [ ! -f "${f}" ]
then
${MVN} -f "${PULSAR_HOME}/pom.xml" dependency:build-classpath -Dmdep.outputFile="${f}" &> /dev/null
(
cd "${PULSAR_HOME}"
${MVN} -pl distribution/server generate-sources &> /dev/null
)
fi
PULSAR_CLASSPATH=${CLASSPATH}:`cat "${f}"`
}
Expand Down
5 changes: 4 additions & 1 deletion bin/pulsar-perf
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ add_maven_deps_to_classpath() {
f="${PULSAR_HOME}/distribution/server/target/classpath.txt"
if [ ! -f "${f}" ]
then
${MVN} -f "${PULSAR_HOME}/pom.xml" dependency:build-classpath -Dmdep.outputFile="${f}" &> /dev/null
(
cd "${PULSAR_HOME}"
${MVN} -pl distribution/server generate-sources &> /dev/null
)
fi
PULSAR_CLASSPATH=${CLASSPATH}:`cat "${f}"`
}
Expand Down
2 changes: 1 addition & 1 deletion site2/tools/docker-build-site.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ CROWDIN_DOCUSAURUS_API_KEY=${CROWDIN_DOCUSAURUS_API_KEY:-UNSET}

DOCKER_CMD="docker run -i -e CI_USER=$CI_USER -e CI_GROUP=$CI_GROUP -v $HOME/.m2:/root/.m2 -e CROWDIN_DOCUSAURUS_PROJECT_ID=${CROWDIN_DOCUSAURUS_PROJECT_ID} -e CROWDIN_DOCUSAURUS_API_KEY=${CROWDIN_DOCUSAURUS_API_KEY} -v $ROOT_DIR:/pulsar $IMAGE"

$DOCKER_CMD bash -l -c 'cd /pulsar && /pulsar/site2/tools/build-site.sh'
$DOCKER_CMD bash -l -c 'cd /pulsar && rm -f distribution/server/target/classpath.txt && /pulsar/site2/tools/build-site.sh'